This is why I prefer to expose my type through an interface and let others
access the type variables through its methods. I just need to make sure the
variables are properly initialized when accessed, and the rest of the code does
not need to be littered with nil check.
--
You received this me
As a side note, I'm probably stating the obvious here, but this is only a
problem because your type is `*Attribute`. Should it be `Attribute`
instead, your struct would be properly initialized with its fields to their
zero value.
I mention it because I'm not sure myself why, from a design point
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
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
>
>
>
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, January 13, 2017 at 6:42:25 PM UTC+1, mail...@gmail.com wrote:
>
>
> Can you give example how this validation can be done via such interface ?
>
>
On Fri, 13 Jan 2017, at 05:17 PM, mailte...@gmail.com wrote:
>
> Hello,
>
> Ignoring the error does not help
>
> https://play.golang.org/p/a8AIcHWII6
You changed your code by making your JSON valid so this is now a
different problem to the one you originally asked.
You can tak
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,
you could also implment unmarshaler interface
https://blog.gopheracademy.com/advent-2016/advanced-encoding-decoding/
On Friday, January 13, 2017 at 6:18:01 PM UTC+1, mail...@gmail.com wrote:
>
>
> Hello,
>
> Ignoring the error does not help
>
> https://play.golang.org/p/a8AIcHWII6
>
> Thank yo
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
On Fri, 13 Jan 2017, at 10:12 AM, mailte...@gmail.com wrote:
>
> 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://pl
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
11 matches
Mail list logo