From 1fcd199cf7366a15f0e94f2892cb5b2cb5c27efa Mon Sep 17 00:00:00 2001 From: Mikhail Mazurskiy Date: Thu, 5 Apr 2018 20:40:20 +1000 Subject: [PATCH] Put nil back into switch --- staging/src/k8s.io/apimachinery/pkg/runtime/converter.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/staging/src/k8s.io/apimachinery/pkg/runtime/converter.go b/staging/src/k8s.io/apimachinery/pkg/runtime/converter.go index 66125dbef23..91920535d36 100644 --- a/staging/src/k8s.io/apimachinery/pkg/runtime/converter.go +++ b/staging/src/k8s.io/apimachinery/pkg/runtime/converter.go @@ -446,9 +446,6 @@ func DeepCopyJSON(x map[string]interface{}) map[string]interface{} { // DeepCopyJSONValue deep copies the passed value, assuming it is a valid JSON representation i.e. only contains // types produced by json.Unmarshal(). func DeepCopyJSONValue(x interface{}) interface{} { - if x == nil { - return nil - } switch x := x.(type) { case map[string]interface{}: if x == nil { @@ -470,7 +467,7 @@ func DeepCopyJSONValue(x interface{}) interface{} { clone[i] = DeepCopyJSONValue(v) } return clone - case string, int64, bool, float64, encodingjson.Number: + case string, int64, bool, float64, nil, encodingjson.Number: return x default: panic(fmt.Errorf("cannot deep copy %T", x))