From b3119ed9f76fc1524f52a6776a4284d80a33594d Mon Sep 17 00:00:00 2001 From: Simao Gomes Viana Date: Wed, 1 Sep 2021 10:52:55 +0200 Subject: [PATCH] Fix map/slice regression caused by #32 Maps and slices that are nil are empty and valid. The change introduced by #32 which fixes #31 has changed how nil slices and maps are marshaled (`null` instead of `[]`). Fix this regression by removing maps and slices from the check. --- sheriff.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sheriff.go b/sheriff.go index 022a8d7..7fc8441 100644 --- a/sheriff.go +++ b/sheriff.go @@ -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 }