Both of the ones below give me reasonable results (probably because they are the same?)
reflect.ValueOf(v) == reflect.Zero(reflect.TypeOf(v))) reflect.DeepEqual(reflect.ValueOf(v), reflect.Zero(reflect.TypeOf(v)))
eg. various integer 0 flavors and uninitialized struct are "zero"
Unfortunately, empty strings and arrays are not. and nil gives an exception.
If you would like, you could take advantage of a special occasion.
source share