From f71718d6448418d0289b9649905a16bfb1962b68 Mon Sep 17 00:00:00 2001 From: Abirdcfly Date: Tue, 19 Jul 2022 00:58:17 +0800 Subject: [PATCH] clean Unreachable code Signed-off-by: Abirdcfly --- pkg/proxy/endpoints_test.go | 1 - .../src/k8s.io/apiserver/pkg/endpoints/apiserver_test.go | 6 +++--- staging/src/k8s.io/client-go/dynamic/fake/simple.go | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pkg/proxy/endpoints_test.go b/pkg/proxy/endpoints_test.go index 31f1370bb6e..3aeaa18985a 100644 --- a/pkg/proxy/endpoints_test.go +++ b/pkg/proxy/endpoints_test.go @@ -1897,7 +1897,6 @@ func compareEndpointsMapsStr(t *testing.T, newMap EndpointsMap, expected map[Ser newEp, ok := newMap[x][i].(*BaseEndpointInfo) if !ok { t.Fatalf("Failed to cast endpointsInfo") - continue } if !endpointEqual(newEp, expected[x][i]) { t.Fatalf("expected new[%v][%d] to be %v, got %v"+ diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/apiserver_test.go b/staging/src/k8s.io/apiserver/pkg/endpoints/apiserver_test.go index 1c4c2fb66f5..c744e876e78 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/apiserver_test.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/apiserver_test.go @@ -37,9 +37,9 @@ import ( "testing" "time" - restful "github.com/emicklei/go-restful/v3" + "github.com/emicklei/go-restful/v3" - fuzzer "k8s.io/apimachinery/pkg/api/apitesting/fuzzer" + "k8s.io/apimachinery/pkg/api/apitesting/fuzzer" apiequality "k8s.io/apimachinery/pkg/api/equality" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" @@ -2839,7 +2839,7 @@ func TestDeleteWithOptionsQuery(t *testing.T) { t.Fatalf("unexpected error: %v", err) } if res.StatusCode != http.StatusOK { - t.Fatalf("unexpected response: %s %#v", request.URL, res) + t.Errorf("unexpected response: %s %#v", request.URL, res) s, err := ioutil.ReadAll(res.Body) if err != nil { t.Fatalf("unexpected error: %v", err) diff --git a/staging/src/k8s.io/client-go/dynamic/fake/simple.go b/staging/src/k8s.io/client-go/dynamic/fake/simple.go index 197508c81d4..02a797ad336 100644 --- a/staging/src/k8s.io/client-go/dynamic/fake/simple.go +++ b/staging/src/k8s.io/client-go/dynamic/fake/simple.go @@ -491,8 +491,7 @@ func (c *dynamicResourceClient) Apply(ctx context.Context, name string, obj *uns if err := c.client.scheme.Convert(uncastRet, ret, nil); err != nil { return nil, err } - return ret, err - return nil, nil + return ret, nil } func (c *dynamicResourceClient) ApplyStatus(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions) (*unstructured.Unstructured, error) {