It was easier than i expected 

https://play.golang.org/p/olooozwapD

On Friday, 13 January 2017 19:13:16 UTC+1, [email protected] 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, January 13, 2017 at 6:42:25 PM UTC+1, [email protected] wrote:
>>
>>
>> Can you give example how this validation can be done via such interface ? 
>>
>> On Friday, 13 January 2017 18:27:51 UTC+1, [email protected] wrote:
>>>
>>> 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, [email protected] 
>>> wrote:
>>>>
>>>>
>>>> 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, [email protected] 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://play.golang.org/p/pY4F9bK-D9
>>>>>
>>>>>
>>>>> In this case you must not ignore the error returned from 
>>>>> json.Unmarshal. If an error is returned then p will be nil.
>>>>>
>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to