mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #94387 from habibrosyad/patch-92402-9
fix vendor/k8s.io/apimachinery/pkg/conversion staticcheck
This commit is contained in:
commit
eb1fa66aac
@ -13,7 +13,6 @@ test/integration/ttlcontroller
|
|||||||
vendor/k8s.io/apimachinery/pkg/api/apitesting/roundtrip
|
vendor/k8s.io/apimachinery/pkg/api/apitesting/roundtrip
|
||||||
vendor/k8s.io/apimachinery/pkg/api/meta
|
vendor/k8s.io/apimachinery/pkg/api/meta
|
||||||
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation
|
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
|
||||||
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json
|
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json
|
||||||
vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning
|
vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning
|
||||||
|
@ -13,7 +13,6 @@ go_test(
|
|||||||
"helper_test.go",
|
"helper_test.go",
|
||||||
],
|
],
|
||||||
embed = [":go_default_library"],
|
embed = [":go_default_library"],
|
||||||
deps = ["//vendor/github.com/spf13/pflag:go_default_library"],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
|
@ -303,37 +303,6 @@ func (s *scope) errorf(message string, args ...interface{}) error {
|
|||||||
return fmt.Errorf(where+message, args...)
|
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
|
// 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
|
// types to the provided function. The function *must* accept objects of a and b - this machinery will not enforce
|
||||||
// any other guarantee.
|
// any other guarantee.
|
||||||
@ -636,10 +605,6 @@ type kvValue interface {
|
|||||||
|
|
||||||
type stringMapAdaptor reflect.Value
|
type stringMapAdaptor reflect.Value
|
||||||
|
|
||||||
func (a stringMapAdaptor) len() int {
|
|
||||||
return reflect.Value(a).Len()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a stringMapAdaptor) keys() []string {
|
func (a stringMapAdaptor) keys() []string {
|
||||||
v := reflect.Value(a)
|
v := reflect.Value(a)
|
||||||
keys := make([]string, v.Len())
|
keys := make([]string, v.Len())
|
||||||
@ -669,11 +634,6 @@ func (a stringMapAdaptor) confirmSet(key string, v reflect.Value) bool {
|
|||||||
|
|
||||||
type structAdaptor reflect.Value
|
type structAdaptor reflect.Value
|
||||||
|
|
||||||
func (a structAdaptor) len() int {
|
|
||||||
v := reflect.Value(a)
|
|
||||||
return v.Type().NumField()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a structAdaptor) keys() []string {
|
func (a structAdaptor) keys() []string {
|
||||||
v := reflect.Value(a)
|
v := reflect.Value(a)
|
||||||
t := v.Type()
|
t := v.Type()
|
||||||
|
@ -21,12 +21,8 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"testing"
|
"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 {
|
func testLogger(t *testing.T) DebugLogger {
|
||||||
// We don't set logger to eliminate rubbish logs in tests.
|
// We don't set logger to eliminate rubbish logs in tests.
|
||||||
// If you want to switch it, simply switch it to: "return t"
|
// If you want to switch it, simply switch it to: "return t"
|
||||||
|
Loading…
Reference in New Issue
Block a user