fix vendor/k8s.io/apimachinery/pkg/api/meta staticcheck

This commit is contained in:
M. Habib Rosyad 2020-08-10 21:26:36 +07:00
parent 24a9d07bf8
commit 979fba1cb0
3 changed files with 4 additions and 9 deletions

View File

@ -7,7 +7,6 @@ test/integration/framework
test/integration/garbagecollector test/integration/garbagecollector
test/integration/scheduler_perf test/integration/scheduler_perf
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/apis/meta/v1/validation vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation
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

View File

@ -40,8 +40,6 @@ func CommonAccessor(obj interface{}) (metav1.Common, error) {
switch t := obj.(type) { switch t := obj.(type) {
case List: case List:
return t, nil return t, nil
case metav1.ListInterface:
return t, nil
case ListMetaAccessor: case ListMetaAccessor:
if m := t.GetListMeta(); m != nil { if m := t.GetListMeta(); m != nil {
return m, nil return m, nil
@ -72,8 +70,6 @@ func ListAccessor(obj interface{}) (List, error) {
switch t := obj.(type) { switch t := obj.(type) {
case List: case List:
return t, nil return t, nil
case metav1.ListInterface:
return t, nil
case ListMetaAccessor: case ListMetaAccessor:
if m := t.GetListMeta(); m != nil { if m := t.GetListMeta(); m != nil {
return m, nil return m, nil

View File

@ -588,23 +588,23 @@ func TestRESTMapperRESTMappingSelectsVersion(t *testing.T) {
} }
// mismatch of version // mismatch of version
mapping, err = mapper.RESTMapping(internalObjectGK, expectedGroupVersion2.Version) _, err = mapper.RESTMapping(internalObjectGK, expectedGroupVersion2.Version)
if err == nil { if err == nil {
t.Errorf("unexpected non-error") t.Errorf("unexpected non-error")
} }
mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion1.Version) _, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion1.Version)
if err == nil { if err == nil {
t.Errorf("unexpected non-error") t.Errorf("unexpected non-error")
} }
// not in the search versions // not in the search versions
mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion3.Version) _, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion3.Version)
if err == nil { if err == nil {
t.Errorf("unexpected non-error") t.Errorf("unexpected non-error")
} }
// explicit search order // explicit search order
mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion3.Version, expectedGroupVersion1.Version) _, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion3.Version, expectedGroupVersion1.Version)
if err == nil { if err == nil {
t.Errorf("unexpected non-error") t.Errorf("unexpected non-error")
} }