diff --git a/hack/.staticcheck_failures b/hack/.staticcheck_failures index 4ef3cf855f5..99abea7bc69 100644 --- a/hack/.staticcheck_failures +++ b/hack/.staticcheck_failures @@ -1,11 +1,6 @@ cluster/images/etcd/migrate vendor/k8s.io/apimachinery/pkg/api/apitesting/roundtrip vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation -vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy -vendor/k8s.io/apimachinery/pkg/util/net -vendor/k8s.io/apimachinery/pkg/util/sets/types -vendor/k8s.io/apimachinery/pkg/util/strategicpatch -vendor/k8s.io/apimachinery/pkg/util/wait vendor/k8s.io/apiserver/pkg/endpoints/filters vendor/k8s.io/apiserver/pkg/endpoints/metrics vendor/k8s.io/apiserver/pkg/server/dynamiccertificates diff --git a/staging/src/k8s.io/apimachinery/pkg/util/httpstream/spdy/roundtripper.go b/staging/src/k8s.io/apimachinery/pkg/util/httpstream/spdy/roundtripper.go index 4cb1cfadcb0..b8e329571ee 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/httpstream/spdy/roundtripper.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/httpstream/spdy/roundtripper.go @@ -183,8 +183,11 @@ func (s *SpdyRoundTripper) dial(req *http.Request) (net.Conn, error) { return nil, err } + //lint:ignore SA1019 ignore deprecated httputil.NewProxyClientConn proxyClientConn := httputil.NewProxyClientConn(proxyDialConn, nil) _, err = proxyClientConn.Do(&proxyReq) + //lint:ignore SA1019 ignore deprecated httputil.ErrPersistEOF: it might be + // returned from the invocation of proxyClientConn.Do if err != nil && err != httputil.ErrPersistEOF { return nil, err } diff --git a/staging/src/k8s.io/apimachinery/pkg/util/net/http.go b/staging/src/k8s.io/apimachinery/pkg/util/net/http.go index ce69b8054b5..d75ac6efa2d 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/net/http.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/net/http.go @@ -113,6 +113,7 @@ func SetOldTransportDefaults(t *http.Transport) *http.Transport { t.Proxy = NewProxierWithNoProxyCIDR(http.ProxyFromEnvironment) } // If no custom dialer is set, use the default context dialer + //lint:file-ignore SA1019 Keep supporting deprecated Dial method of custom transports if t.DialContext == nil && t.Dial == nil { t.DialContext = defaultTransport.DialContext } diff --git a/staging/src/k8s.io/apimachinery/pkg/util/sets/types/types.go b/staging/src/k8s.io/apimachinery/pkg/util/sets/types/types.go index 4cb853aa0c9..2218dbc46fe 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/sets/types/types.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/sets/types/types.go @@ -20,6 +20,7 @@ limitations under the License. package types //go:generate set-gen -i k8s.io/kubernetes/pkg/util/sets/types +//lint:file-ignore U1000 Ignore unused fields type ReferenceSetTypes struct { // These types all cause files to be generated. diff --git a/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go b/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go index 600f3befd2e..fd2081a28d5 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go @@ -987,10 +987,10 @@ func validatePatchWithSetOrderList(patchList, setOrderList interface{}, mergeKey return nil } - var nonDeleteList, toDeleteList []interface{} + var nonDeleteList []interface{} var err error if len(mergeKey) > 0 { - nonDeleteList, toDeleteList, err = extractToDeleteItems(typedPatchList) + nonDeleteList, _, err = extractToDeleteItems(typedPatchList) if err != nil { return err } @@ -1018,7 +1018,6 @@ func validatePatchWithSetOrderList(patchList, setOrderList interface{}, mergeKey if patchIndex < len(nonDeleteList) && setOrderIndex >= len(typedSetOrderList) { return fmt.Errorf("The order in patch list:\n%v\n doesn't match %s list:\n%v\n", typedPatchList, setElementOrderDirectivePrefix, setOrderList) } - typedPatchList = append(nonDeleteList, toDeleteList...) return nil } diff --git a/staging/src/k8s.io/apimachinery/pkg/util/wait/wait_test.go b/staging/src/k8s.io/apimachinery/pkg/util/wait/wait_test.go index 1729736467c..dbd3dfbda39 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/wait/wait_test.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/wait/wait_test.go @@ -422,6 +422,7 @@ func TestPollImmediateError(t *testing.T) { func TestPollForever(t *testing.T) { ch := make(chan struct{}) + errc := make(chan error, 1) done := make(chan struct{}, 1) complete := make(chan struct{}) go func() { @@ -436,7 +437,7 @@ func TestPollForever(t *testing.T) { }) if err := PollInfinite(time.Microsecond, f); err != nil { - t.Fatalf("unexpected error %v", err) + errc <- fmt.Errorf("unexpected error %v", err) } close(ch) @@ -451,7 +452,10 @@ func TestPollForever(t *testing.T) { select { case _, open := <-ch: if !open { - t.Fatalf("did not expect channel to be closed") + if len(errc) != 0 { + t.Fatalf("did not expect channel to be closed, %v", <-errc) + } + t.Fatal("did not expect channel to be closed") } case <-time.After(ForeverTestTimeout): t.Fatalf("channel did not return at least once within the poll interval") @@ -467,9 +471,13 @@ func TestPollForever(t *testing.T) { return } } - t.Fatalf("expected closed channel after two iterations") + t.Error("expected closed channel after two iterations") }() <-complete + + if len(errc) != 0 { + t.Fatal(<-errc) + } } func TestWaitFor(t *testing.T) {