Skip to content

Commit

Permalink
Fix map/slice regression caused by liip#32
Browse files Browse the repository at this point in the history
Maps and slices that are nil are empty and valid.
The change introduced by liip#32 which fixes liip#31 has changed how
nil slices and maps are marshaled (`null` instead of `[]`).

Fix this regression by removing maps and slices from the check.
  • Loading branch information
simaotwx committed Sep 1, 2021
1 parent a143a78 commit b3119ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sheriff.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func marshalValue(options *Options, v reflect.Value) (interface{}, error) {
k := v.Kind()

switch k {
case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
case reflect.Interface, reflect.Ptr:
if v.IsNil() {
return val, nil
}
Expand Down

0 comments on commit b3119ed

Please sign in to comment.