Re: [go-nuts] Re: How to initialize all members of a slice

2016-10-04 Thread ahmed . momena
Thank you guys for helping me out. The problem was not with "string" type members, it was "bool" type. I wanted to set the default as true if it was not present in the input. Without using unmarshallJSON, I have no way of setting it, right? On Monday, October 3, 2016 at 9:28:49 PM UTC-5, Lars Sei

Re: [go-nuts] Re: How to initialize all members of a slice

2016-10-03 Thread Lars Seipel
On Mon, Oct 03, 2016 at 04:19:34PM -0700, C Banning wrote: > Lot's of people will jump up and down that this is "unsafe," but if you're > building a utility and have complete control of the code something like > this might work: https://play.golang.org/p/eDPoI83C0u Not necessarily unsafe, just u

[go-nuts] Re: How to initialize all members of a slice

2016-10-03 Thread C Banning
Lot's of people will jump up and down that this is "unsafe," but if you're building a utility and have complete control of the code something like this might work: https://play.golang.org/p/eDPoI83C0u On Sunday, October 2, 2016 at 10:39:08 PM UTC-6, Sarah Ahmed wrote: > > Hello, > I am trying to

[go-nuts] Re: How to initialize all members of a slice

2016-10-03 Thread Val
Hello Sarah, I managed to run something implementing json.Unmarshaler : see code on playground There are probably better/cleaner ways of doing that, suggestions welcome. Please note : - the pointer receiver (a *Address) - the local type AddressGhost, just to