[go-nuts] Re: map[X]Y or map[X]*Y ?

2017-05-12 Thread jmontgomery
In addition to the god points that others have made, there is a difference in the way that memory will be allocated. See https://play.golang.org/p/l6d4lODiDx and pay attention to the "delta" lines. In this particular example, using a map to a pointer does a Malloc for every map item, whereas

[go-nuts] Re: go test: no tests to run

2017-04-21 Thread jmontgomery
Yes, your tests should have the the *same *package name as your code, so in this case *package pybr*. They will not effect the package when built normally. They are only included when running *go test*. You also need to name your tests correctly, and they need a signature like: func

[go-nuts] Re: golint if/else stmt and early returns

2017-03-17 Thread jmontgomery
While there may be better ways to express what this logic, for clarity, here is the change that golint is actually suggesting: // Load returns the list of partition found and their properties. func (l *LinuxLoader) Load() ([]*Properties, error) { //- ret := []*Properties{} if temp,

Re: [go-nuts] Cross compiling from Windows to Linux produces non-working go routines

2017-03-08 Thread jmontgomery
On Wednesday, March 8, 2017 at 9:50:09 AM UTC-5, Chris Hines wrote: > > The infinite loops in each function will busy loop and consume a core > without allowing the runtime scheduler a chance to run other goroutines on > that core. If your virtual machine doesn't have enough cores then some >

Re: [go-nuts] is this race condition normal?

2017-02-19 Thread jmontgomery
On Sunday, February 19, 2017 at 3:41:13 AM UTC-5, Marwan abdel moneim wrote: > > i wanted to do it without a Mutex > but there still something not clear to me, but i don't know what it is > and i don't understand what "trigger" synchronization means > > i will keep reading, and go back to it

[go-nuts] Re: Type declarations and the underlying type's methods

2017-01-20 Thread jmontgomery
should mention that what you want can be achieved with composition using anonymous fields: https://play.golang.org/p/vEKS70A-29 I know its not your original question, and this only works with `strcut` and `interface`, not build in types, like `int`. But it does give you the kind of behavior