This should get you started. https://play.golang.org/p/fKGkJPMToy

On Tuesday, 22 November 2016 21:58:31 UTC+11, iAdvice Edge wrote:
>
> i am new to Golang.
>
> can you just share some piece of code just to check each field in struct 
> for empty or nil or zero value.
>
> On Tue, Nov 22, 2016 at 4:19 PM, Dave Cheney <da...@cheney.net 
> <javascript:>> wrote:
>
>> If you want to write a general function you will need to use the reflect 
>> package, specifically reflect.Value.IsValid to check each field to see if 
>> it contains the zero value or not.
>>
>> --
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "golang-nuts" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/golang-nuts/neGz_Rxtxxw/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> golang-nuts...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to