diff --git a/hack/.staticcheck_failures b/hack/.staticcheck_failures index 040e361bac6..876567e3b7f 100644 --- a/hack/.staticcheck_failures +++ b/hack/.staticcheck_failures @@ -13,7 +13,6 @@ test/integration/ttlcontroller vendor/k8s.io/apimachinery/pkg/api/apitesting/roundtrip vendor/k8s.io/apimachinery/pkg/api/meta vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation -vendor/k8s.io/apimachinery/pkg/conversion vendor/k8s.io/apimachinery/pkg/runtime vendor/k8s.io/apimachinery/pkg/runtime/serializer/json vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning diff --git a/staging/src/k8s.io/apimachinery/pkg/conversion/BUILD b/staging/src/k8s.io/apimachinery/pkg/conversion/BUILD index 3b6c8296bb7..4d6ec9dd271 100644 --- a/staging/src/k8s.io/apimachinery/pkg/conversion/BUILD +++ b/staging/src/k8s.io/apimachinery/pkg/conversion/BUILD @@ -13,7 +13,6 @@ go_test( "helper_test.go", ], embed = [":go_default_library"], - deps = ["//vendor/github.com/spf13/pflag:go_default_library"], ) go_library( diff --git a/staging/src/k8s.io/apimachinery/pkg/conversion/converter.go b/staging/src/k8s.io/apimachinery/pkg/conversion/converter.go index 838d5b0aac8..d9b2a7ef9d0 100644 --- a/staging/src/k8s.io/apimachinery/pkg/conversion/converter.go +++ b/staging/src/k8s.io/apimachinery/pkg/conversion/converter.go @@ -303,37 +303,6 @@ func (s *scope) errorf(message string, args ...interface{}) error { return fmt.Errorf(where+message, args...) } -// Verifies whether a conversion function has a correct signature. -func verifyConversionFunctionSignature(ft reflect.Type) error { - if ft.Kind() != reflect.Func { - return fmt.Errorf("expected func, got: %v", ft) - } - if ft.NumIn() != 3 { - return fmt.Errorf("expected three 'in' params, got: %v", ft) - } - if ft.NumOut() != 1 { - return fmt.Errorf("expected one 'out' param, got: %v", ft) - } - if ft.In(0).Kind() != reflect.Ptr { - return fmt.Errorf("expected pointer arg for 'in' param 0, got: %v", ft) - } - if ft.In(1).Kind() != reflect.Ptr { - return fmt.Errorf("expected pointer arg for 'in' param 1, got: %v", ft) - } - scopeType := Scope(nil) - if e, a := reflect.TypeOf(&scopeType).Elem(), ft.In(2); e != a { - return fmt.Errorf("expected '%v' arg for 'in' param 2, got '%v' (%v)", e, a, ft) - } - var forErrorType error - // This convolution is necessary, otherwise TypeOf picks up on the fact - // that forErrorType is nil. - errorType := reflect.TypeOf(&forErrorType).Elem() - if ft.Out(0) != errorType { - return fmt.Errorf("expected error return, got: %v", ft) - } - return nil -} - // RegisterUntypedConversionFunc registers a function that converts between a and b by passing objects of those // types to the provided function. The function *must* accept objects of a and b - this machinery will not enforce // any other guarantee. @@ -636,10 +605,6 @@ type kvValue interface { type stringMapAdaptor reflect.Value -func (a stringMapAdaptor) len() int { - return reflect.Value(a).Len() -} - func (a stringMapAdaptor) keys() []string { v := reflect.Value(a) keys := make([]string, v.Len()) @@ -669,11 +634,6 @@ func (a stringMapAdaptor) confirmSet(key string, v reflect.Value) bool { type structAdaptor reflect.Value -func (a structAdaptor) len() int { - v := reflect.Value(a) - return v.Type().NumField() -} - func (a structAdaptor) keys() []string { v := reflect.Value(a) t := v.Type() diff --git a/staging/src/k8s.io/apimachinery/pkg/conversion/converter_test.go b/staging/src/k8s.io/apimachinery/pkg/conversion/converter_test.go index 21ec5f32ae7..eef51e88342 100644 --- a/staging/src/k8s.io/apimachinery/pkg/conversion/converter_test.go +++ b/staging/src/k8s.io/apimachinery/pkg/conversion/converter_test.go @@ -21,12 +21,8 @@ import ( "reflect" "strconv" "testing" - - flag "github.com/spf13/pflag" ) -var fuzzIters = flag.Int("fuzz-iters", 50, "How many fuzzing iterations to do.") - func testLogger(t *testing.T) DebugLogger { // We don't set logger to eliminate rubbish logs in tests. // If you want to switch it, simply switch it to: "return t"