Skip to content

Commit eb1fa66

Browse files
authored
Merge pull request kubernetes#94387 from habibrosyad/patch-92402-9
fix vendor/k8s.io/apimachinery/pkg/conversion staticcheck
2 parents e077b0f + 9444a2f commit eb1fa66

File tree

4 files changed

+0
-46
lines changed

4 files changed

+0
-46
lines changed

hack/.staticcheck_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ test/integration/ttlcontroller
1313
vendor/k8s.io/apimachinery/pkg/api/apitesting/roundtrip
1414
vendor/k8s.io/apimachinery/pkg/api/meta
1515
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation
16-
vendor/k8s.io/apimachinery/pkg/conversion
1716
vendor/k8s.io/apimachinery/pkg/runtime
1817
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json
1918
vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning

staging/src/k8s.io/apimachinery/pkg/conversion/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ go_test(
1313
"helper_test.go",
1414
],
1515
embed = [":go_default_library"],
16-
deps = ["//vendor/github.com/spf13/pflag:go_default_library"],
1716
)
1817

1918
go_library(

staging/src/k8s.io/apimachinery/pkg/conversion/converter.go

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -303,37 +303,6 @@ func (s *scope) errorf(message string, args ...interface{}) error {
303303
return fmt.Errorf(where+message, args...)
304304
}
305305

306-
// Verifies whether a conversion function has a correct signature.
307-
func verifyConversionFunctionSignature(ft reflect.Type) error {
308-
if ft.Kind() != reflect.Func {
309-
return fmt.Errorf("expected func, got: %v", ft)
310-
}
311-
if ft.NumIn() != 3 {
312-
return fmt.Errorf("expected three 'in' params, got: %v", ft)
313-
}
314-
if ft.NumOut() != 1 {
315-
return fmt.Errorf("expected one 'out' param, got: %v", ft)
316-
}
317-
if ft.In(0).Kind() != reflect.Ptr {
318-
return fmt.Errorf("expected pointer arg for 'in' param 0, got: %v", ft)
319-
}
320-
if ft.In(1).Kind() != reflect.Ptr {
321-
return fmt.Errorf("expected pointer arg for 'in' param 1, got: %v", ft)
322-
}
323-
scopeType := Scope(nil)
324-
if e, a := reflect.TypeOf(&scopeType).Elem(), ft.In(2); e != a {
325-
return fmt.Errorf("expected '%v' arg for 'in' param 2, got '%v' (%v)", e, a, ft)
326-
}
327-
var forErrorType error
328-
// This convolution is necessary, otherwise TypeOf picks up on the fact
329-
// that forErrorType is nil.
330-
errorType := reflect.TypeOf(&forErrorType).Elem()
331-
if ft.Out(0) != errorType {
332-
return fmt.Errorf("expected error return, got: %v", ft)
333-
}
334-
return nil
335-
}
336-
337306
// RegisterUntypedConversionFunc registers a function that converts between a and b by passing objects of those
338307
// types to the provided function. The function *must* accept objects of a and b - this machinery will not enforce
339308
// any other guarantee.
@@ -636,10 +605,6 @@ type kvValue interface {
636605

637606
type stringMapAdaptor reflect.Value
638607

639-
func (a stringMapAdaptor) len() int {
640-
return reflect.Value(a).Len()
641-
}
642-
643608
func (a stringMapAdaptor) keys() []string {
644609
v := reflect.Value(a)
645610
keys := make([]string, v.Len())
@@ -669,11 +634,6 @@ func (a stringMapAdaptor) confirmSet(key string, v reflect.Value) bool {
669634

670635
type structAdaptor reflect.Value
671636

672-
func (a structAdaptor) len() int {
673-
v := reflect.Value(a)
674-
return v.Type().NumField()
675-
}
676-
677637
func (a structAdaptor) keys() []string {
678638
v := reflect.Value(a)
679639
t := v.Type()

staging/src/k8s.io/apimachinery/pkg/conversion/converter_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,8 @@ import (
2121
"reflect"
2222
"strconv"
2323
"testing"
24-
25-
flag "github.com/spf13/pflag"
2624
)
2725

28-
var fuzzIters = flag.Int("fuzz-iters", 50, "How many fuzzing iterations to do.")
29-
3026
func testLogger(t *testing.T) DebugLogger {
3127
// We don't set logger to eliminate rubbish logs in tests.
3228
// If you want to switch it, simply switch it to: "return t"

0 commit comments

Comments
 (0)