[go-nuts] constructors vs lazy initialization

2018-03-03 Thread Jérôme LAFORGE
Not sure that is relevant for your example, but if do can be called by multiple goroutines, then you have to use atomic.Once (store within the struct) in order to initialize. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

Re: [go-nuts] Re: General question: complex search form and query params

2018-03-03 Thread Benjamin Thomas
Unless I'm misunderstanding something, that kind of string concatenation looks dangerous to me. I'v been doing a bit of digging... Turns out there is a DSL that looks like what I'm looking for: the Lucene query syntax . Some variant

[go-nuts] fast small prime checker

2018-03-03 Thread ralphdoncaster
It still has room for optimization, but it is much faster than ProbablyPrime(0) for 32-bit integers. http://nerdralph.blogspot.ca/2018/03/fast-small-prime-checker-in-golang.html -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

[go-nuts] Re: constructors vs lazy initialization

2018-03-03 Thread Dave Cheney
I prefer the later when possible because it enables callers to use the zero value of a type without explicit initialisation. On Sunday, 4 March 2018 11:37:43 UTC+11, Anmol Sethi wrote: > > How do you guys choose between constructors and lazy initialization? > > For example. > > Struct

[go-nuts] constructors vs lazy initialization

2018-03-03 Thread 'Anmol Sethi' via golang-nuts
How do you guys choose between constructors and lazy initialization? For example. Struct constructors: type meow struct { x http.Handler } func newMeow() *meow { return { x: http.NewServeMux(), } } func (m *meow) do() { // stuff } Lazy initialization: type meow

[go-nuts] Re: My views on Go and why it's better than Scripting

2018-03-03 Thread matthewjuran
I like Go because it improves on C for engineers in almost every way and avoids classes, and, at least today, if you have a problem then it will be solved quickly by the people following the GitHub issue tracker and contributing to the source code. Go avoids complexities such as generics (aka

[go-nuts] Re: General question: complex search form and query params

2018-03-03 Thread matthewjuran
Mapping a subset DSL to SQL doesn’t sound too difficult since SQL already has those boolean expressions and such. The database/sql library uses context for cancellation, so queries that take too long could be cancelled by a timer goroutine. One thing for me that would be helped by a library is

[go-nuts] A Simple In Memory Database.

2018-03-03 Thread Anto Aravinth
Hello, I'm new to Golang and in order to learn the language, I have created a simple in-memory database, that stores the value in map. Along the way, I noted & written the tutorial for the same, which will help the beginners. The source code is over here:

[go-nuts] an experimental golang dynamic loader

2018-03-03 Thread luwencong123
github.com/dearplain/goloader -- 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 more options, visit

[go-nuts] Re: My views on Go and why it's better than Scripting

2018-03-03 Thread dorival . pedroso
Thanks for your suggestions! On Saturday, March 3, 2018 at 5:56:41 AM UTC-8, Alex Rice wrote: > > Hi, thanks for sharing. I am not convinced about the reasons stated why Go > is better than the other languages you mentioned. I am just learning Go, > but I have 20 years of experience as a

[go-nuts] Re: My views on Go and why it's better than Scripting

2018-03-03 Thread Alex Rice
Hi, thanks for sharing. I am not convinced about the reasons stated why Go is better than the other languages you mentioned. I am just learning Go, but I have 20 years of experience as a professional developer using various languages. I think students, beginners and professionals should use Go

Re: [go-nuts] High precision timer data?

2018-03-03 Thread Donovan Hide
Looks like you may have hit this: https://github.com/golang/go/issues/22601 On 3 March 2018 at 09:30, James Chacon wrote: > > > On Thu, Mar 1, 2018 at 11:59 PM, James Chacon > wrote: > >> >> >> On Thu, Mar 1, 2018 at 11:07 PM, James Chacon

Re: [go-nuts] High precision timer data?

2018-03-03 Thread James Chacon
On Thu, Mar 1, 2018 at 11:59 PM, James Chacon wrote: > > > On Thu, Mar 1, 2018 at 11:07 PM, James Chacon > wrote: > >> >> >> On Thu, Mar 1, 2018 at 10:13 AM, Ian Lance Taylor >> wrote: >> >>> On Thu, Mar 1, 2018 at 8:56 AM, James