Re: [go-nuts] Golang text template - time.Format epoch

2016-12-07 Thread 'Sergey Krutsko' via golang-nuts
Thanks Marvin! that's exactly what i need bwt, is there any way to get current timestamp inside the template (without referencing to the data structure) ? something like that: "timestamp: {{time.Now.Unix}}" On Wednesday, December 7, 2016 at 5:47:36 PM UTC+3, Marvin Renich wrote: > > * skrutsko

Re: [go-nuts] Trouble with fonts

2016-12-07 Thread Nigel Tao
On Thu, Dec 8, 2016 at 3:32 PM, Lucio wrote: >> A text editor widget might expose its text content as a []byte, >> instead of a []rune, since in the latter representation, the >> underlying array takes 4x the memory for ASCII text, a common case. >> > I would choose to err on the side of intuition

Re: [go-nuts] Trouble with fonts

2016-12-07 Thread Lucio
On Thursday, 8 December 2016 03:10:33 UTC+2, Nigel Tao wrote: > > On Wed, Dec 7, 2016 at 5:49 PM, Lucio > > wrote: > > The first issue is one of documentation. It says in > > that: > > > > DrawBytes draws s at the dot and advances the dot's locatio

[go-nuts] Re: Struct Compatibility in unix.Syscall

2016-12-07 Thread Dragos Harabor
Also, take a look at this post: https://utcc.utoronto.ca/~cks/space/blog/programming/GoCGoCompatibleStructs I do quite a bit of ioctl stuff and generate all my Go structs using the cgo tool just because the C side is not stable yet and still changes a lot, I could not keep up with the changes an

[go-nuts] Re: Struct Compatibility in unix.Syscall

2016-12-07 Thread Steven Logan
I was concerned that there might be a fundamental issue that would make this a massive pain, wasn't expecting it to be quite this straight forward. I'll have a go at these suggestions tomorrow, Cheers! -- You received this message because you are subscribed to the Google Groups "golang-nuts" gr

Re: [go-nuts] Trouble with fonts

2016-12-07 Thread Nigel Tao
On Wed, Dec 7, 2016 at 5:49 PM, Lucio wrote: > The first issue is one of documentation. It says in > that: > > DrawBytes draws s at the dot and advances the dot's location. > > But it leaves the question of what exactly those bytes are supposed to > repr

[go-nuts] Idiomatic way of handling http requests in separate goroutines

2016-12-07 Thread Pablo Rozas Larraondo
Hi gophers, I'm designing a service exposed through a http server which uses a pool of workers to process requests. At the moment my handlerFunc look similar to this: func aHandler(w http.ResponseWriter, r *http.Request) { var wg sync.WaitGroup wg.Add(1) reqQueue <- &Reque

[go-nuts] Re: Struct Compatibility in unix.Syscall

2016-12-07 Thread Dragos Harabor
You can use go tool cgo -godefs *file*.go to generate the Go structs from C structs and either use them as-is or get an idea how you should pad your hand-written Go structs. file.go will have to do an import of the right .h file(s), something like: /* #include "file.h" */ import "C" ... On Tuesd

Re: [go-nuts] go install seems to do a lot of rebuilding in a container

2016-12-07 Thread Dave Cheney
s/go build -i/go install. On Thu, Dec 8, 2016 at 8:07 AM, andrey mirtchovski wrote: > it's also possible that you need to do "go build -i" just in case your > dependencies are outdated. i had the same issue today with a windows > piece of code that rebuilt sqlite3 every time. > > > On Wed, Dec 7,

Re: [go-nuts] go install seems to do a lot of rebuilding in a container

2016-12-07 Thread andrey mirtchovski
it's also possible that you need to do "go build -i" just in case your dependencies are outdated. i had the same issue today with a windows piece of code that rebuilt sqlite3 every time. On Wed, Dec 7, 2016 at 2:57 PM, Dave Cheney wrote: > Docker add, or whatever is pushing files into your conta

[go-nuts] go install seems to do a lot of rebuilding in a container

2016-12-07 Thread Dave Cheney
Docker add, or whatever is pushing files into your container is probably not respecting timestamps so the .a files are older with respect to .go files (pkg sorts above src) Why do you want to build inside a container, is that just adding an extra level of indirection to what is a simple process

[go-nuts] Structs and enums

2016-12-07 Thread bartfokker
You could do something like this: type Base int const ( A Base = iota C T G ) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to go

[go-nuts] Re: Golang-present as a standalone

2016-12-07 Thread Val
Hi, maybe you visited https://godoc.org/golang.org/x/tools/present , and are looking for https://godoc.org/golang.org/x/tools/cmd/present . Or maybe you would like an embedded graphical UI, instead of using a web browser? On Wednesday, December 7, 2016 at 7:42:29 PM UTC+1, Volker Dobler wrote: >

[go-nuts] go install seems to do a lot of rebuilding in a container

2016-12-07 Thread Shaun Crampton
Hi, I'm trying to optimize the build of my app. Our build times have crept up to ~60s as we've added more dependencies and it's starting to become a problem. The primary problem seems to be that we're building in a container, so we're losing the $GOPATH/pkg cache of build artefacts between bu

Re: [go-nuts] Index operator on pointer to array or slice

2016-12-07 Thread Jonathan
Using a struct type Heap struct { items []Item } func (h *Heap) Pop() interface{} { ... } func (h *Heap) Push(x interface{}) { ... } lets you use the more legible (to me, anyway) h.items[i] Jonathan -- You received this message because you are subscribed to the Google Groups "golang-nut

[go-nuts] Handling nil embedded interfaces

2016-12-07 Thread Traun Leyden
What's the best practice around handling embedded interfaces that are nil? For example: https://play.golang.org/p/EcqV7h9cNU Is there a better way than wrapping the embedded interface's methods and forwarding down as long as it's not nil? I guess another approach would be to create a NoOpEven

[go-nuts] Re: Golang-present as a standalone

2016-12-07 Thread Volker Dobler
As the present tool _is_ a standalone binary I'm not sure what you are asking for. You you want the presentation to be included in the binary? V. Am Mittwoch, 7. Dezember 2016 19:03:18 UTC+1 schrieb savino@gmail.com: > > Hello folks, > > is there a way to have a "present" tool as a standalon

[go-nuts] Structs and enums

2016-12-07 Thread Merzouki M'heni
Hello. I'm new to golang. I have to create a struct type which has fields that can be one of a range of specific values (the equivalent of enumerations in JAVA or other languages) This is the struct

[go-nuts] Golang-present as a standalone

2016-12-07 Thread savino . liguori
Hello folks, is there a way to have a "present" tool as a standalone binary? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups

[go-nuts] converting slice of items into nested array

2016-12-07 Thread aaron
I'm pretty new to golang and struggling a bit with converting flat database results into a nested JSON object. As an example... I have type item struct { raceID string racename string name string votesint32 } type race struct { raceID string racename string racers } type racers

[go-nuts] Re: Strange, intermittent panic issues

2016-12-07 Thread brikis98
Ah, I gotcha. OK, off I go to dig for unsafe.Pointer and cgo usages in a dependency :) Thanks! Jim On Wednesday, December 7, 2016 at 1:04:23 AM UTC-5, Dave Cheney wrote: > > > > On Wednesday, 7 December 2016 12:52:17 UTC+9, brik...@gmail.com wrote: >> >> 0xb01dfacedebac1e is a poison pill that u

[go-nuts] Re: HTTP server triggers 'Access-Control-Allow-Origin' header contains multiple values error

2016-12-07 Thread paul . h . breslin
Ok, I've since discovered that there's an nginx proxy in front of my service that is adding the header. Sorry for the false alarm. :( Problem resolved. On Tuesday, December 6, 2016 at 5:30:12 PM UTC-5, paul.h@gmail.com wrote: > > We have a simple http service running using the net/http

Re: [go-nuts] Golang text template - time.Format epoch

2016-12-07 Thread Marvin Renich
* skrutsko via golang-nuts [161207 08:30]: > Hello > > I have a field in my text template: "start":"{{.Start.Format "Jan 02, 2006 > 15:04:05 UTC"}}" > > But, I want to have output as epoch time. E.g. 148110633400 > > Could you please explain how to do this ? Thanks Do you mean Unix time (sec

[go-nuts] Golang text template - time.Format epoch

2016-12-07 Thread skrutsko via golang-nuts
Hello I have a field in my text template: "start":"{{.Start.Format "Jan 02, 2006 15:04:05 UTC"}}" But, I want to have output as epoch time. E.g. 148110633400 Could you please explain how to do this ? Thanks -- You received this message because you are subscribed to the Google Groups "golang

[go-nuts] Re: Problem with slice and object copy

2016-12-07 Thread Nilton Henrique Kummer
Hi Paulo, Just FYI. Next time that you have debugging, you can use fmt.Printf("%p", item). The param %p will show the memory address value. []'s Em terça-feira, 6 de dezembro de 2016 20:40:26 UTC-2, Paulo Coutinho escreveu: > > Hi, > > In my project i have a slice of Healthcheck objects. > > O

[go-nuts] HTTP server triggers 'Access-Control-Allow-Origin' header contains multiple values error

2016-12-07 Thread Dave Cheney
Grep for that string in GOROOT, it's not there, the net/http package is probably not adding it. Can you create a stand alone program that shows the problem? Dave -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group a

[go-nuts] Re: Unmarshal into struct where root struct field is a dynamic field

2016-12-07 Thread Viktor Kojouharov
It seems to me that the response is always a map[string]SomeStruct{}. Nothing wrong with that. On Wednesday, December 7, 2016 at 12:02:57 AM UTC+2, vanmuld...@gmail.com wrote: > > An example JSON response : > > Query : /id/123456 > > Response : > > > {"123456":{"id":123456,"name":"qsdsdqsdqs