Re: [go-nuts] slice of pointer of struct vs slice of struct

2017-10-19 Thread Jan Mercl
On Fri, Oct 20, 2017 at 7:25 AM Feby Tanzil wrote: > Which is better & preferable in Go? Depends on size of T. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

[go-nuts] slice of pointer of struct vs slice of struct

2017-10-19 Thread Feby Tanzil
Hi, I got vague answers in the internet over this. Which is better & preferable in Go? type T struct { // some attributes ... } func a() []T { } func b() []*T { } Thanks -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

Re: [go-nuts] repeatable builds

2017-10-19 Thread Nathan Kerr
Another option for 2 is https://github.com/cloudflare/hellogopher -- 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.com. For

Re: [go-nuts] Re: Any way to somehow include readable source code into compiled binaries?

2017-10-19 Thread Samuel Lampa
Hi Seb! :) On Thursday, October 19, 2017 at 9:00:46 PM UTC+2, Sebastien Binet wrote: > > On Thu, Oct 19, 2017 at 8:51 PM, Alex Buchanan > wrote: > >> But, maybe a better solution is to faithfully record the current git (or >> other VCS) details you'd need to find the code

Re: [go-nuts] Re: Any way to somehow include readable source code into compiled binaries?

2017-10-19 Thread Samuel Lampa
We use go-bindata to bundle text files (html, js, css, yaml) into our binary. I bet you could use it to bundle Go source. https://github.com/jteeuwen/go-bindata Ah, this is great, Thanks! On 2017-10-19 20:51, Alex Buchanan wrote: But, maybe a

Re: [go-nuts] Re: Any way to somehow include readable source code into compiled binaries?

2017-10-19 Thread Sebastien Binet
On Thu, Oct 19, 2017 at 8:51 PM, Alex Buchanan wrote: > But, maybe a better solution is to faithfully record the current git (or > other VCS) details you'd need to find the code which resulted in the > binary? That way you have access to the source in its natural state.

[go-nuts] Re: Any way to somehow include readable source code into compiled binaries?

2017-10-19 Thread Alex Buchanan
But, maybe a better solution is to faithfully record the current git (or other VCS) details you'd need to find the code which resulted in the binary? That way you have access to the source in its natural state. On Thursday, October 19, 2017 at 11:49:39 AM UTC-7, Alex Buchanan wrote: > > We use

[go-nuts] Re: Panic recovery and mutex lock question

2017-10-19 Thread Tamás Gulácsi
Quote from the language reference: "A "defer" statement invokes a function whose execution is deferred to the moment the surrounding function returns, either because the surrounding function executed a return statement, reached the end of its function body, or because the corresponding

[go-nuts] Re: Any way to somehow include readable source code into compiled binaries?

2017-10-19 Thread Alex Buchanan
We use go-bindata to bundle text files (html, js, css, yaml) into our binary. I bet you could use it to bundle Go source. https://github.com/jteeuwen/go-bindata -Alex On Thursday, October 19, 2017 at 9:46:37 AM UTC-7, Samuel Lampa wrote: > > Hi Gophers, > > *Question:* Is there any way to

Re: [go-nuts] nil maps

2017-10-19 Thread roger peppe
Or taking it a bit further: https://play.golang.org/p/g4uF2QjiJQ On 18 October 2017 at 23:38, Alex Dvoretskiy wrote: > Looks fun!: https://play.golang.org/p/8mqzb-1H7f > > On Tuesday, October 17, 2017 at 10:39:46 AM UTC-7, Thomas Bushnell, BSG > wrote: >> >> Here's a

Re: [go-nuts] Blocking in C functions called from go

2017-10-19 Thread 'Pushkar Pradhan' via golang-nuts
Konstantin, Thanks for the detailed explanation. That was helpful. On Thu, Oct 19, 2017 at 3:51 AM, Konstantin Khomoutov wrote: > On Fri, Oct 13, 2017 at 12:23:42PM -0700, 'Pushkar' via golang-nuts wrote: > > > I need to call some C functions from Go. I think I know how to

Re: [go-nuts] C's readdir equivalent

2017-10-19 Thread Bakul Shah
On Thu, 19 Oct 2017 09:29:09 -0700 Ian Lance Taylor wrote: Ian Lance Taylor writes: > On Wed, Oct 18, 2017 at 10:54 PM, Bakul Shah wrote: > > > > os.Readdirnames() just returns dir enry names[1], while > > os.Readdir() lstats all the dir entries. > > > >

[go-nuts] Any way to somehow include readable source code into compiled binaries?

2017-10-19 Thread Samuel Lampa
Hi Gophers, *Question:* Is there any way to include a readable verison of the source code of my program into the compiled Go binary, either in plain text, or the ability extract it somehow, with some go tooling or 3rd party tools? *Background:* The reason for asking is that we are using Go to

Re: [go-nuts] C's readdir equivalent

2017-10-19 Thread Ian Lance Taylor
On Wed, Oct 18, 2017 at 10:54 PM, Bakul Shah wrote: > > os.Readdirnames() just returns dir enry names[1], while > os.Readdir() lstats all the dir entries. > > Pretty much every OS's (C lang) readdir() returns a direntry's > type without having to stat the underlying file.

[go-nuts] Re: dynamic xml

2017-10-19 Thread Jim Cote
You'll need to use an UnmarshalXML func for the params: // Param is a tag w/ any name type Param struct { Namestring `xml:"-"` Typestring `xml:"type,attr"` MinOccurs int`xml:"minOccurs,attr"` MaxOccurs int`xml:"maxOccurs,attr"` Description string

[go-nuts] Re: dynamic xml

2017-10-19 Thread Jim Cote
You'll need to use a custom UnmarshalXML func to handle this. // TopLevel is of course top level type TopLevel struct { Description string `xml:"description"` Rights Rights `xml:"rights"` Method []Method `xml:"method"` } // Method has request type Method struct { Name

Re: [go-nuts] Re: "html/dom" alternative to html/template for true separation of concerns?

2017-10-19 Thread jens . schoedt
@Karv Prime I was looking for a library for this but i have not been able to find any yet. Did you have any luck? I have worked with http://www.thymeleaf.org/ for Java extensively and I really enjoyed it. Its a lot easier to work with the front-end people with legal html. Dom manipulation

[go-nuts] Re: Help with viper please.

2017-10-19 Thread John Episcopo
Hi guys, I'm having trouble with this too. My code is as follows: v := viper.New() viper.SetConfigName("settings") viper.SetConfigType("json") viper.AddConfigPath(".") v.AutomaticEnv() err := v.ReadInConfig() if err != nil { logrus.Fatal("Fatal error config file: ",

[go-nuts] Re: Panic recovery and mutex lock question

2017-10-19 Thread David Renne
OK I think I have my questions answered, I think the moral is dont intermix or add code above your lock if you are worried about any panics calling it before, this way you know that you are in a lock right when the function hits it and can always defer the unlock until after. I suppose in

Re: [go-nuts] Re: perfs of a Go binary VS C++

2017-10-19 Thread mura
Hi, Can you publish the C++ test program as well ? I have the ROOT installed and would like to explore the issue further. -mura On Wednesday, October 18, 2017 at 6:21:17 PM UTC+8, mura wrote: > > Could you use `perf record ./test f64s.root` and then `perf report > --stdio` for both the Go and

Re: [go-nuts] Re: perfs of a Go binary VS C++

2017-10-19 Thread Sebastien Binet
On Thu, Oct 19, 2017 at 8:32 AM, Sokolov Yura wrote: > Why io is not buffered? > https://github.com/go-hep/hep/blob/master/rootio/file.go#L95 > > Use bufio > that was also my first knee-jerk reaction. but I can't do that: the reader needs to implement io.Reader,

Re: [go-nuts] Re: perfs of a Go binary VS C++

2017-10-19 Thread Sokolov Yura
Why io is not buffered? https://github.com/go-hep/hep/blob/master/rootio/file.go#L95 Use bufio -- 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