diff --git a/pkg/kubelet/cm/cpumanager/state/checkpoint.go b/pkg/kubelet/cm/cpumanager/state/checkpoint.go index e7df594efc5..ca6d2fc90a3 100644 --- a/pkg/kubelet/cm/cpumanager/state/checkpoint.go +++ b/pkg/kubelet/cm/cpumanager/state/checkpoint.go @@ -53,7 +53,7 @@ type CPUManagerCheckpointV2 = CPUManagerCheckpoint // NewCPUManagerCheckpoint returns an instance of Checkpoint func NewCPUManagerCheckpoint() *CPUManagerCheckpoint { - //lint:ignore unexported-type-in-api user-facing error message + //nolint:staticcheck // unexported-type-in-api user-facing error message return newCPUManagerCheckpointV2() } diff --git a/pkg/kubelet/cm/cpumanager/state/state_checkpoint.go b/pkg/kubelet/cm/cpumanager/state/state_checkpoint.go index f501c2bea30..c9aacd19051 100644 --- a/pkg/kubelet/cm/cpumanager/state/state_checkpoint.go +++ b/pkg/kubelet/cm/cpumanager/state/state_checkpoint.go @@ -54,7 +54,7 @@ func NewCheckpointState(stateDir, checkpointName, policyName string, initialCont } if err := stateCheckpoint.restoreState(); err != nil { - //lint:ignore ST1005 user-facing error message + //nolint:staticcheck // ST1005 user-facing error message return nil, fmt.Errorf("could not restore state from checkpoint: %v, please drain this node and delete the CPU manager checkpoint file %q before restarting Kubelet", err, path.Join(stateDir, checkpointName)) } diff --git a/pkg/kubelet/cm/memorymanager/state/checkpoint.go b/pkg/kubelet/cm/memorymanager/state/checkpoint.go index a43b40272e0..93b1302baa1 100644 --- a/pkg/kubelet/cm/memorymanager/state/checkpoint.go +++ b/pkg/kubelet/cm/memorymanager/state/checkpoint.go @@ -35,7 +35,7 @@ type MemoryManagerCheckpoint struct { // NewMemoryManagerCheckpoint returns an instance of Checkpoint func NewMemoryManagerCheckpoint() *MemoryManagerCheckpoint { - //lint:ignore unexported-type-in-api user-facing error message + //nolint:staticcheck // unexported-type-in-api user-facing error message return &MemoryManagerCheckpoint{ Entries: ContainerMemoryAssignments{}, MachineState: NUMANodeMap{}, diff --git a/pkg/kubelet/cm/memorymanager/state/state_checkpoint.go b/pkg/kubelet/cm/memorymanager/state/state_checkpoint.go index 3607234094b..286b9fda819 100644 --- a/pkg/kubelet/cm/memorymanager/state/state_checkpoint.go +++ b/pkg/kubelet/cm/memorymanager/state/state_checkpoint.go @@ -50,7 +50,7 @@ func NewCheckpointState(stateDir, checkpointName, policyName string) (State, err } if err := stateCheckpoint.restoreState(); err != nil { - //lint:ignore ST1005 user-facing error message + //nolint:staticcheck // ST1005 user-facing error message return nil, fmt.Errorf("could not restore state from checkpoint: %v, please drain this node and delete the memory manager checkpoint file %q before restarting Kubelet", err, path.Join(stateDir, checkpointName)) } diff --git a/pkg/kubelet/stats/cri_stats_provider.go b/pkg/kubelet/stats/cri_stats_provider.go index 10fe4d55b33..3690e0c09af 100644 --- a/pkg/kubelet/stats/cri_stats_provider.go +++ b/pkg/kubelet/stats/cri_stats_provider.go @@ -68,9 +68,8 @@ type criStatsProvider struct { imageService internalapi.ImageManagerService // hostStatsProvider is used to get the status of the host filesystem consumed by pods. hostStatsProvider HostStatsProvider - //lint:ignore U1000 We can't import hcsshim due to Build constraints in hcsshim // windowsNetworkStatsProvider is used by kubelet to gather networking stats on Windows - windowsNetworkStatsProvider interface{} + windowsNetworkStatsProvider interface{} //nolint:unused // U1000 We can't import hcsshim due to Build constraints in hcsshim // clock is used report current time clock clock.Clock diff --git a/pkg/registry/batch/job/storage/storage.go b/pkg/registry/batch/job/storage/storage.go index 2fdb108158f..e87b1bc0a8e 100644 --- a/pkg/registry/batch/job/storage/storage.go +++ b/pkg/registry/batch/job/storage/storage.go @@ -18,6 +18,7 @@ package storage import ( "context" + "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -96,7 +97,7 @@ func (r *REST) Categories() []string { } func (r *REST) Delete(ctx context.Context, name string, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions) (runtime.Object, bool, error) { - //lint:ignore SA1019 backwards compatibility + //nolint:staticcheck // SA1019 backwards compatibility //nolint: staticcheck if options != nil && options.PropagationPolicy == nil && options.OrphanDependents == nil && job.Strategy.DefaultGarbageCollectionPolicy(ctx) == rest.OrphanDependents { @@ -108,8 +109,7 @@ func (r *REST) Delete(ctx context.Context, name string, deleteValidation rest.Va } func (r *REST) DeleteCollection(ctx context.Context, deleteValidation rest.ValidateObjectFunc, deleteOptions *metav1.DeleteOptions, listOptions *internalversion.ListOptions) (runtime.Object, error) { - //lint:ignore SA1019 backwards compatibility - //nolint: staticcheck + //nolint:staticcheck // SA1019 backwards compatibility if deleteOptions.PropagationPolicy == nil && deleteOptions.OrphanDependents == nil && job.Strategy.DefaultGarbageCollectionPolicy(ctx) == rest.OrphanDependents { // Throw a warning if delete options are not explicitly set as Job deletion strategy by default is orphaning diff --git a/pkg/util/coverage/fake_test_deps.go b/pkg/util/coverage/fake_test_deps.go index a03fc9171e3..a9506d4c77f 100644 --- a/pkg/util/coverage/fake_test_deps.go +++ b/pkg/util/coverage/fake_test_deps.go @@ -23,33 +23,41 @@ import ( // This is an implementation of testing.testDeps. It doesn't need to do anything, because // no tests are actually run. It does need a concrete implementation of at least ImportPath, // which is called unconditionally when running tests. -//lint:ignore U1000 see comment above, we know it's unused normally. +//nolint:unused // U1000 see comment above, we know it's unused normally. type fakeTestDeps struct{} +//nolint:unused // U1000 see comment above, we know it's unused normally. func (fakeTestDeps) ImportPath() string { return "" } +//nolint:unused // U1000 see comment above, we know it's unused normally. func (fakeTestDeps) MatchString(pat, str string) (bool, error) { return false, nil } +//nolint:unused // U1000 see comment above, we know it's unused normally. func (fakeTestDeps) StartCPUProfile(io.Writer) error { return nil } +//nolint:unused // U1000 see comment above, we know it's unused normally. func (fakeTestDeps) StopCPUProfile() {} +//nolint:unused // U1000 see comment above, we know it's unused normally. func (fakeTestDeps) StartTestLog(io.Writer) {} +//nolint:unused // U1000 see comment above, we know it's unused normally. func (fakeTestDeps) StopTestLog() error { return nil } +//nolint:unused // U1000 see comment above, we know it's unused normally. func (fakeTestDeps) WriteHeapProfile(io.Writer) error { return nil } +//nolint:unused // U1000 see comment above, we know it's unused normally. func (fakeTestDeps) WriteProfileTo(string, io.Writer, int) error { return nil } diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/pruning/algorithm_test.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/pruning/algorithm_test.go index b7b5ec7604d..403d25e21a9 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/pruning/algorithm_test.go +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/pruning/algorithm_test.go @@ -636,7 +636,7 @@ func BenchmarkDeepCopy(b *testing.B) { b.StartTimer() for i := 0; i < b.N; i++ { - //lint:ignore SA4010 the result of append is never used, it's acceptable since in benchmark testing. + //nolint:staticcheck //iccheck // SA4010 the result of append is never used, it's acceptable since in benchmark testing. instances = append(instances, runtime.DeepCopyJSON(obj)) } } diff --git a/staging/src/k8s.io/apimachinery/pkg/api/apitesting/roundtrip/roundtrip.go b/staging/src/k8s.io/apimachinery/pkg/api/apitesting/roundtrip/roundtrip.go index 0c320e578b9..2502c98b722 100644 --- a/staging/src/k8s.io/apimachinery/pkg/api/apitesting/roundtrip/roundtrip.go +++ b/staging/src/k8s.io/apimachinery/pkg/api/apitesting/roundtrip/roundtrip.go @@ -25,7 +25,7 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - //lint:ignore SA1019 Keep using deprecated module; it still seems to be maintained and the api of the recommended replacement differs + //nolint:staticcheck //iccheck // SA1019 Keep using deprecated module; it still seems to be maintained and the api of the recommended replacement differs "github.com/golang/protobuf/proto" fuzz "github.com/google/gofuzz" flag "github.com/spf13/pflag" diff --git a/staging/src/k8s.io/apimachinery/pkg/labels/selector_test.go b/staging/src/k8s.io/apimachinery/pkg/labels/selector_test.go index 7c061462dd5..37e50345420 100644 --- a/staging/src/k8s.io/apimachinery/pkg/labels/selector_test.go +++ b/staging/src/k8s.io/apimachinery/pkg/labels/selector_test.go @@ -148,7 +148,7 @@ func expectMatchDirect(t *testing.T, selector, ls Set) { } } -//lint:ignore U1000 currently commented out in TODO of TestSetMatches +//nolint:staticcheck //iccheck // U1000 currently commented out in TODO of TestSetMatches //nolint:unused,deadcode func expectNoMatchDirect(t *testing.T, selector, ls Set) { if SelectorFromSet(selector).Matches(ls) { diff --git a/staging/src/k8s.io/apimachinery/pkg/util/framer/framer.go b/staging/src/k8s.io/apimachinery/pkg/util/framer/framer.go index 45aa74bf582..10df0d99cd5 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/framer/framer.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/framer/framer.go @@ -132,14 +132,14 @@ func (r *jsonFrameReader) Read(data []byte) (int, error) { // Return whatever remaining data exists from an in progress frame if n := len(r.remaining); n > 0 { if n <= len(data) { - //lint:ignore SA4006,SA4010 underlying array of data is modified here. + //nolint:staticcheck // SA4006,SA4010 underlying array of data is modified here. data = append(data[0:0], r.remaining...) r.remaining = nil return n, nil } n = len(data) - //lint:ignore SA4006,SA4010 underlying array of data is modified here. + //nolint:staticcheck // SA4006,SA4010 underlying array of data is modified here. data = append(data[0:0], r.remaining[:n]...) r.remaining = r.remaining[n:] return n, io.ErrShortBuffer @@ -157,7 +157,7 @@ func (r *jsonFrameReader) Read(data []byte) (int, error) { // and set m to it, which means we need to copy the partial result back into data and preserve // the remaining result for subsequent reads. if len(m) > n { - //lint:ignore SA4006,SA4010 underlying array of data is modified here. + //nolint:staticcheck // SA4006,SA4010 underlying array of data is modified here. data = append(data[0:0], m[:n]...) r.remaining = m[n:] return n, io.ErrShortBuffer 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 b8e329571ee..086e4bcf0b9 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,10 +183,10 @@ func (s *SpdyRoundTripper) dial(req *http.Request) (net.Conn, error) { return nil, err } - //lint:ignore SA1019 ignore deprecated httputil.NewProxyClientConn + //nolint:staticcheck // SA1019 ignore deprecated httputil.NewProxyClientConn proxyClientConn := httputil.NewProxyClientConn(proxyDialConn, nil) _, err = proxyClientConn.Do(&proxyReq) - //lint:ignore SA1019 ignore deprecated httputil.ErrPersistEOF: it might be + //nolint:staticcheck // 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/apiserver/pkg/endpoints/handlers/delete.go b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/delete.go index e58495bed27..05ccd393087 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/delete.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/delete.go @@ -143,7 +143,7 @@ func DeleteResource(r rest.GracefulDeleter, allowsOptions bool, scope *RequestSc // that will break existing clients. // Other cases where resource is not instantly deleted are: namespace deletion // and pod graceful deletion. - //lint:ignore SA1019 backwards compatibility + //nolint:staticcheck // SA1019 backwards compatibility //nolint: staticcheck if !wasDeleted && options.OrphanDependents != nil && !*options.OrphanDependents { status = http.StatusAccepted diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/fieldmanager_test.go b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/fieldmanager_test.go index aaf86cec0ac..a627a25a4d2 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/fieldmanager_test.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/fieldmanager_test.go @@ -55,7 +55,7 @@ type fakeObjectConvertor struct { apiVersion fieldpath.APIVersion } -//lint:ignore SA4009 backwards compatibility +//nolint:staticcheck // SA4009 backwards compatibility func (c *fakeObjectConvertor) Convert(in, out, context interface{}) error { if typedValue, ok := in.(*typed.TypedValue); ok { var err error diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/errors_test.go b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/errors_test.go index a772a136ee5..33231bd5e6b 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/errors_test.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/errors_test.go @@ -83,7 +83,7 @@ func TestForbidden(t *testing.T) { if result != test.expected { t.Errorf("Forbidden response body(%#v...)\n expected: %v\ngot: %v", test.attributes, test.expected, result) } - //lint:ignore SA1019 backwards compatibility + //nolint:staticcheck // SA1019 backwards compatibility resultType := observer.HeaderMap.Get("Content-Type") if resultType != test.contentType { t.Errorf("Forbidden content type(%#v...) != %#v, got %#v", test.attributes, test.expected, result) diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/responsewriter/wrapper.go b/staging/src/k8s.io/apiserver/pkg/endpoints/responsewriter/wrapper.go index 46af09f7180..758e7addd28 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/responsewriter/wrapper.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/responsewriter/wrapper.go @@ -120,7 +120,7 @@ func GetOriginal(w http.ResponseWriter) http.ResponseWriter { return GetOriginal(inner) } -//lint:ignore SA1019 backward compatibility +//nolint:staticcheck // SA1019 var _ http.CloseNotifier = outerWithCloseNotifyAndFlush{} var _ http.Flusher = outerWithCloseNotifyAndFlush{} var _ http.ResponseWriter = outerWithCloseNotifyAndFlush{} diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/responsewriter/wrapper_test.go b/staging/src/k8s.io/apiserver/pkg/endpoints/responsewriter/wrapper_test.go index 9fd08c60d42..3c52e06cf23 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/responsewriter/wrapper_test.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/responsewriter/wrapper_test.go @@ -61,7 +61,7 @@ func TestWithHTTP1(t *testing.T) { // so each decorator is expected to tick the count by one for each method. defer counterGot.assert(t, &counter{FlushInvoked: 3, CloseNotifyInvoked: 3, HijackInvoked: 3}) - //lint:ignore SA1019 backward compatibility + //nolint:staticcheck // SA1019 w.(http.CloseNotifier).CloseNotify() w.(http.Flusher).Flush() @@ -116,7 +116,7 @@ func TestWithHTTP2(t *testing.T) { // so each decorator is expected to tick the count by one for each method. defer counterGot.assert(t, &counter{FlushInvoked: 3, CloseNotifyInvoked: 3, HijackInvoked: 0}) - //lint:ignore SA1019 backward compatibility + //nolint:staticcheck // SA1019 w.(http.CloseNotifier).CloseNotify() w.(http.Flusher).Flush() @@ -242,7 +242,7 @@ func assertCloseNotifierFlusherHijacker(t *testing.T, hijackableExpected bool, w t.Errorf("Expected the http.ResponseWriter object to implement http.Flusher") } - //lint:ignore SA1019 backward compatibility + //nolint:staticcheck // SA1019 if _, ok := w.(http.CloseNotifier); !ok { t.Errorf("Expected the http.ResponseWriter object to implement http.CloseNotifier") } @@ -293,6 +293,6 @@ func (fw *fakeResponseWriterDecorator) CloseNotify() <-chan bool { if fw.counter != nil { fw.counter.CloseNotifyInvoked++ } - //lint:ignore SA1019 backward compatibility + //nolint:staticcheck // SA1019 return fw.ResponseWriter.(http.CloseNotifier).CloseNotify() } diff --git a/staging/src/k8s.io/apiserver/pkg/registry/generic/registry/store.go b/staging/src/k8s.io/apiserver/pkg/registry/generic/registry/store.go index eead4e568d4..9897a295240 100644 --- a/staging/src/k8s.io/apiserver/pkg/registry/generic/registry/store.go +++ b/staging/src/k8s.io/apiserver/pkg/registry/generic/registry/store.go @@ -753,9 +753,9 @@ func shouldOrphanDependents(ctx context.Context, e *Store, accessor metav1.Objec } // An explicit policy was set at deletion time, that overrides everything - //lint:ignore SA1019 backwards compatibility + //nolint:staticcheck // SA1019 backwards compatibility if options != nil && options.OrphanDependents != nil { - //lint:ignore SA1019 backwards compatibility + //nolint:staticcheck // SA1019 backwards compatibility return *options.OrphanDependents } if options != nil && options.PropagationPolicy != nil { @@ -796,7 +796,7 @@ func shouldDeleteDependents(ctx context.Context, e *Store, accessor metav1.Objec } // If an explicit policy was set at deletion time, that overrides both - //lint:ignore SA1019 backwards compatibility + //nolint:staticcheck // SA1019 backwards compatibility if options != nil && options.OrphanDependents != nil { return false } diff --git a/staging/src/k8s.io/client-go/discovery/discovery_client.go b/staging/src/k8s.io/client-go/discovery/discovery_client.go index 96159ab7ab2..50e59c5d85c 100644 --- a/staging/src/k8s.io/client-go/discovery/discovery_client.go +++ b/staging/src/k8s.io/client-go/discovery/discovery_client.go @@ -27,7 +27,7 @@ import ( "sync" "time" - //lint:ignore SA1019 Keep using module since it's still being maintained and the api of google.golang.org/protobuf/proto differs + //nolint:staticcheck // SA1019 Keep using module since it's still being maintained and the api of google.golang.org/protobuf/proto differs "github.com/golang/protobuf/proto" openapi_v2 "github.com/googleapis/gnostic/openapiv2" diff --git a/staging/src/k8s.io/component-base/metrics/legacyregistry/registry.go b/staging/src/k8s.io/component-base/metrics/legacyregistry/registry.go index ff38953ba36..56a9dcae58b 100644 --- a/staging/src/k8s.io/component-base/metrics/legacyregistry/registry.go +++ b/staging/src/k8s.io/component-base/metrics/legacyregistry/registry.go @@ -44,9 +44,9 @@ var ( ) func init() { - //lint:ignore SA1019 - replacement function still calls prometheus.NewProcessCollector(). + //nolint:staticcheck // SA1019 - replacement function still calls prometheus.NewProcessCollector(). RawMustRegister(prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{})) - //lint:ignore SA1019 - replacement function still calls prometheus.NewGoCollector(). + //nolint:staticcheck // SA1019 - replacement function still calls prometheus.NewGoCollector(). RawMustRegister(prometheus.NewGoCollector()) } diff --git a/staging/src/k8s.io/controller-manager/app/serve.go b/staging/src/k8s.io/controller-manager/app/serve.go index 2f0e995b605..ba1f465368c 100644 --- a/staging/src/k8s.io/controller-manager/app/serve.go +++ b/staging/src/k8s.io/controller-manager/app/serve.go @@ -66,7 +66,7 @@ func NewBaseHandler(c *componentbaseconfig.DebuggingConfiguration, healthzHandle routes.DebugFlags{}.Install(mux, "v", routes.StringFlagPutHandler(logs.GlogSetter)) } configz.InstallHandler(mux) - //lint:ignore SA1019 See the Metrics Stability Migration KEP + //nolint:staticcheck // SA1019 See the Metrics Stability Migration KEP mux.Handle("/metrics", legacyregistry.Handler()) return mux diff --git a/test/images/agnhost/net/nat/closewait.go b/test/images/agnhost/net/nat/closewait.go index 6bd1c7c93d2..5a344956e5c 100644 --- a/test/images/agnhost/net/nat/closewait.go +++ b/test/images/agnhost/net/nat/closewait.go @@ -38,7 +38,7 @@ import ( // leakedConnection is a global variable that should leak the active // connection assigned here. -//lint:ignore U1000 intentional unused variable +//nolint:unused // U1000 intentional unused variable var leakedConnection *net.TCPConn // CloseWaitServerOptions holds server JSON options.