good morning!!!!

Skip to content
Snippets Groups Projects
Commit 2c7f6672 authored by Carlos Nieto's avatar Carlos Nieto
Browse files

Replacing "ignorenil" with "omitempty" and testing for the zero value of the type.

parent f5204c73
No related branches found
No related tags found
No related merge requests found
...@@ -277,8 +277,9 @@ func (self *T) FieldValues(item interface{}, convertFn func(interface{}) string) ...@@ -277,8 +277,9 @@ func (self *T) FieldValues(item interface{}, convertFn func(interface{}) string)
tag := field.Tag tag := field.Tag
// omitempty:bool // omitempty:bool
if tag.Get("ignorenil") == "true" { if tag.Get("omitempty") == "true" {
if value == nil || value == "" { zero := reflect.Zero(reflect.TypeOf(value)).Interface()
if value == zero {
continue continue
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment