Re: [go-nuts] How do you mitigate against nil pointer dereference

2017-01-14 Thread mailteety
It was easier than i expected https://play.golang.org/p/olooozwapD On Friday, 13 January 2017 19:13:16 UTC+1, mhh...@gmail.com wrote: > > yeah, right, it s possible and works, but its way more complex, lets > forget about this :) > > This works https://play.golang.org/p/hP8Zq-LfQA > > On Friday

Re: [go-nuts] How do you mitigate against nil pointer dereference

2017-01-14 Thread mailteety
It was easier than i expected https://play.golang.org/p/olooozwapD On Friday, 13 January 2017 19:00:14 UTC+1, Ian Davis wrote: > > > > > On Fri, 13 Jan 2017, at 05:17 PM, mail...@gmail.com wrote: > > > Hello, > > Ignoring the error does not help > > https://play.golang.org/p/a8AIcHWII6 > > >

Re: [go-nuts] How do you mitigate against nil pointer dereference

2017-01-13 Thread mailteety
Can you give example how this validation can be done via such interface ? On Friday, 13 January 2017 18:27:51 UTC+1, mhh...@gmail.com wrote: > > you could also implment unmarshaler interface > > https://blog.gopheracademy.com/advent-2016/advanced-encoding-decoding/ > > > > On Friday, January 13,

Re: [go-nuts] How do you mitigate against nil pointer dereference

2017-01-13 Thread mailteety
Hello, Ignoring the error does not help https://play.golang.org/p/a8AIcHWII6 Thank you. On Friday, 13 January 2017 15:38:45 UTC+1, Ian Davis wrote: > > On Fri, 13 Jan 2017, at 10:12 AM, mail...@gmail.com wrote: > > > Hello, > > Have been struggling with mitigating against nil pointer defere

[go-nuts] Re: How do you mitigate against nil pointer dereference

2017-01-13 Thread mailteety
Hello, Thanks for the response. The Major Issue is that am getting the Data from *json *and its inconsistent. Regards Teety On Friday, 13 January 2017 14:41:02 UTC+1, mhh...@gmail.com wrote: > > Hi, > > some simple leads, > > Use one line initialization of Person > p := &Person{Attr:&Attribute{

[go-nuts] How do you mitigate against nil pointer dereference

2017-01-13 Thread mailteety
Hello, Have been struggling with mitigating against nil pointer deference and i would appreciate if anyone can help Code 1: Works file https://play.golang.org/p/lhOh9g5R9l Code 2: Error https://play.golang.org/p/pY4F9bK-D9 How do you validate Attr was set if its a pointer ? Thanks In A