Function
shouldInitializeField
(field reflect.Value, tag string)
Source from the content-addressed store, hash-verified
| 186 | } |
| 187 | |
| 188 | func shouldInitializeField(field reflect.Value, tag string) bool { |
| 189 | switch field.Kind() { |
| 190 | case reflect.Struct: |
| 191 | return true |
| 192 | case reflect.Ptr: |
| 193 | if !field.IsNil() && field.Elem().Kind() == reflect.Struct { |
| 194 | return true |
| 195 | } |
| 196 | case reflect.Slice: |
| 197 | return field.Len() > 0 || tag != "" |
| 198 | } |
| 199 | |
| 200 | return tag != "" |
| 201 | } |
| 202 | |
| 203 | // Setter is an interface for setting default values |
| 204 | type Setter interface { |
Tested by
no test coverage detected