Re: [go-nuts] Pass by value in struct not yielding expected result

2018-03-06 Thread Burak Serdar
On Tue, Mar 6, 2018 at 1:23 PM, wrote: > go version 1.10 > > > Operating system and processor architecture > > GOHOSTARCH="amd64" > GOHOSTOS="darwin" > However, this happens in play.golang.org env as well. > > > Checkout the code. > >

Re: [go-nuts] Pass by value in struct not yielding expected result

2018-03-06 Thread andrey mirtchovski
maybe this will give you a hint: https://play.golang.org/p/ANIjc3tCdwp maps are reference types, but they still get passed by value. if you pass a nil map around, the old value you passed will not magically start pointing to a new map once you instantiate it elsewhere. -- You received this

[go-nuts] Pass by value in struct not yielding expected result

2018-03-06 Thread bharathramh92
go version 1.10 Operating system and processor architecture GOHOSTARCH="amd64" GOHOSTOS="darwin" However, this happens in play.golang.org env as well. Checkout the code. https://play.golang.org/p/v6u7R_nbGRp In the example, if the struct (Document) is not initialized at first, there is no

[go-nuts] JOB : GoLang Programmer : Waltham, MA

2018-03-06 Thread Hemanth
Hi I found your skills relevant to this role with my client. Please let me know your interest along with updated resume. w Share & Spread word about this opening with someone you like. Position : GoLang Programmer Location : Waltham, MA Duration : 6+ months Contract .

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

2018-03-06 Thread Rich
I am a systems administrator. I find it easier and faster to write a program in Go than it is to script it in Bash. Since writing scripts is something most Sys Admins do I've had to write them in Perl, PHP, TCL, Ruby, etc. and the BIGGEST frustration is that I would get a script written

Re: [go-nuts] Pass by value in struct not yielding expected result

2018-03-06 Thread Dave Cheney
On Wednesday, 7 March 2018 07:39:56 UTC+11, andrey mirtchovski wrote: > > maybe this will give you a hint: https://play.golang.org/p/ANIjc3tCdwp > > maps are reference types, but they still get passed by value. > Maps are pointers, pointers are values. -- You received this message because

Re: [go-nuts] Undocumented behaviour - panic exiting with exit code 2?

2018-03-06 Thread Rob Pike
That's poor. Exit code 2 is supposed to mean 'incorrect arguments' in the Unix tradition. Something like 127 or 255 would be better. -rob On Wed, Mar 7, 2018 at 10:39 AM, cachvico wrote: > Curious why panic appears to exit with code 2 ( >

Re: [go-nuts] Undocumented behaviour - panic exiting with exit code 2?

2018-03-06 Thread Rob Pike
Largely in agreement. Moved the conversation to the bug. On Wed, Mar 7, 2018 at 11:08 AM, Ian Lance Taylor wrote: > On Tue, Mar 6, 2018 at 3:55 PM, Rob Pike wrote: > > That's poor. Exit code 2 is supposed to mean 'incorrect arguments' in the > > Unix

Re: [go-nuts] Pass by value in struct not yielding expected result

2018-03-06 Thread Bharath Ram
In that case, for a nested struct from top to bottom, all the values are copies as values, correct? i.e, string, int, float, array etc will be copied by value & map, slice, channel etc will be copied as pointers if they are initialized? https://play.golang.org/p/NzH8LVyQ0rp code works as I

Re: [go-nuts] Undocumented behaviour - panic exiting with exit code 2?

2018-03-06 Thread Rob Pike
https://github.com/golang/go/issues/24284 On Wed, Mar 7, 2018 at 10:55 AM, Rob Pike wrote: > That's poor. Exit code 2 is supposed to mean 'incorrect arguments' in the > Unix tradition. > > Something like 127 or 255 would be better. > > -rob > > On Wed, Mar 7, 2018 at 10:39 AM,

Re: [go-nuts] Undocumented behaviour - panic exiting with exit code 2?

2018-03-06 Thread Ian Lance Taylor
On Tue, Mar 6, 2018 at 3:55 PM, Rob Pike wrote: > That's poor. Exit code 2 is supposed to mean 'incorrect arguments' in the > Unix tradition. > > Something like 127 or 255 would be better. I think you actually set it to 2, back in June, 2008, in what is now known as git revision

Re: [go-nuts] Pass by value in struct not yielding expected result

2018-03-06 Thread Bharath Ram
Thanks a lot! On Mar 6, 2018 5:22 PM, "Burak Serdar" wrote: > On Tue, Mar 6, 2018 at 2:58 PM, Bharath Ram > wrote: > > In that case, for a nested struct from top to bottom, all the values are > > copies as values, correct? i.e, string, int, float,

[go-nuts] Undocumented behaviour - panic exiting with exit code 2?

2018-03-06 Thread cachvico
Curious why panic appears to exit with code 2 (https://golang.org/src/runtime/panic.go line 757) I can't find any mention of this in the spec; this should probably be documented? For example Supervisor treats exit codes 2 (and 0) as "expected" by default, which leads to processes not

Re: [go-nuts] Pass by value in struct not yielding expected result

2018-03-06 Thread Burak Serdar
On Tue, Mar 6, 2018 at 2:58 PM, Bharath Ram wrote: > In that case, for a nested struct from top to bottom, all the values are > copies as values, correct? i.e, string, int, float, array etc will be copied > by value & map, slice, channel etc will be copied as pointers if

[go-nuts] Custom Go Playground using Docker for Sandboxing

2018-03-06 Thread Brad
I'm in the middle of building out a Go library that does various things and am considering hosting something similar to Go Playground which can be used to create demos using the library. Two big snags: 1) I of course need to be able to import my packages, and 2) I need sqlite support, which

[go-nuts] Re: best practices of client middleware

2018-03-06 Thread Eyal Posener
Very Nice stuff - shame he didn't merge it. But I see that you changes the request in the RoundTrip function, which is claimed as forbidden in the docs. Again, I don't understand why the docs forbid it... On Wednesday, March 7, 2018 at 1:52:55 AM UTC+2, Sangjin Lee wrote: > > I offered a PR on

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

2018-03-06 Thread James Chacon
I have a hard time believing that will have anywhere near < 100ns granularity considering time.Sleep has microsecond only in testing. James On Mon, Mar 5, 2018 at 5:00 AM, Frederic Landais wrote: > Hello, > > have you considered using time.NewTicker >

[go-nuts] Re: Compare values in a for loop that ranges over string array of array

2018-03-06 Thread timilsina . ashish . 03
Awesome, that makes so much sense. Thanks for explaining it and your help! On Monday, March 5, 2018 at 4:03:33 PM UTC-7, Ignacio Gómez wrote: > > Hi, Ashish. > > If you have a map[string]int (or int 64, float 64, etc.) "m", doing > > m[key] += value > > > is equivalent to this: > > m[key] =

[go-nuts] Re: best practices of client middleware

2018-03-06 Thread Eyal Posener
Good stuff, So I see that this library wraps the http.Client and doesn't use the roundtripper. Pretty elegant! I still have two questions about the standard library: - Didn't understand yet why it is not allowed to add headers in the roundtripper. - Is this a bit strange that the

Re: [go-nuts] Re: confusing differences in reflect Type knowledge for a receiver vs. an argument

2018-03-06 Thread Ian Lance Taylor
On Mon, Mar 5, 2018 at 9:53 PM, Randall O'Reilly wrote: > On Mar 5, 2018, at 10:32 PM, Ian Lance Taylor wrote: >> >> Go doesn't have anything like inheritance in C++. What you are >> calling the "true underlying type" simply doesn't exist in Go. Go has >>

[go-nuts] Re: What's everyone using as an asset pipeline?

2018-03-06 Thread levko
The go-assets package looks like it might be what you're interested in. It has many features and different handlers. https://github.com/burburas/go-assets On Friday, December 6, 2013 at 6:15:47 AM UTC+2, Alex Zorin wrote: > > Lots of web frameworks out there but we seem to be lacking in the