mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
migrate nolint coments to golangci-lint
This commit is contained in:
parent
272b31da50
commit
d126b14838
@ -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()
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
}
|
||||
|
@ -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{},
|
||||
|
@ -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))
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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{}
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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())
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user