Skip to content

Commit 41b3cd2

Browse files
thaJeztahjsturtevant
authored andcommitted
remove unneeded nolint-comments (nolintlint), disable deprecated linters
Remove nolint-comments that weren't hit by linters, and remove the "structcheck" and "varcheck" linters, as they have been deprecated: WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [linters context] structcheck is disabled because of generics. You can track the evolution of the generics support by following the golangci/golangci-lint#2649. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent bc754f1 commit 41b3cd2

20 files changed

+33
-45
lines changed

.golangci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ linters:
66
- gosec
77
- ineffassign
88
- misspell
9+
- nolintlint
910
- revive
1011
- staticcheck
11-
- structcheck
1212
- tenv # Detects using os.Setenv instead of t.Setenv since Go 1.17
1313
- unconvert
1414
- unused
15-
- varcheck
1615
- vet
1716
disable:
1817
- errcheck

archive/tar_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func setHeaderForSpecialDevice(hdr *tar.Header, name string, fi os.FileInfo) err
5858
return errors.New("unsupported stat type")
5959
}
6060

61-
rdev := uint64(s.Rdev) //nolint:unconvert // rdev is int32 on darwin/bsd, int64 on linux/solaris
61+
rdev := uint64(s.Rdev) //nolint:nolintlint,unconvert // rdev is int32 on darwin/bsd, int64 on linux/solaris
6262

6363
// Currently go does not fill in the major/minors
6464
if s.Mode&syscall.S_IFBLK != 0 ||

integration/main_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func PodSandboxConfigWithCleanup(t *testing.T, name, ns string, opts ...PodSandb
210210
}
211211

212212
// Set Windows HostProcess on the pod.
213-
func WithWindowsHostProcessPod(p *runtime.PodSandboxConfig) { //nolint:unused
213+
func WithWindowsHostProcessPod(p *runtime.PodSandboxConfig) {
214214
if p.Windows == nil {
215215
p.Windows = &runtime.WindowsPodSandboxConfig{}
216216
}
@@ -237,7 +237,7 @@ func WithTestAnnotations() ContainerOpts {
237237
}
238238

239239
// Add container resource limits.
240-
func WithResources(r *runtime.LinuxContainerResources) ContainerOpts { //nolint:unused
240+
func WithResources(r *runtime.LinuxContainerResources) ContainerOpts {
241241
return func(c *runtime.ContainerConfig) {
242242
if c.Linux == nil {
243243
c.Linux = &runtime.LinuxContainerConfig{}
@@ -247,7 +247,7 @@ func WithResources(r *runtime.LinuxContainerResources) ContainerOpts { //nolint:
247247
}
248248

249249
// Adds Windows container resource limits.
250-
func WithWindowsResources(r *runtime.WindowsContainerResources) ContainerOpts { //nolint:unused
250+
func WithWindowsResources(r *runtime.WindowsContainerResources) ContainerOpts {
251251
return func(c *runtime.ContainerConfig) {
252252
if c.Windows == nil {
253253
c.Windows = &runtime.WindowsContainerConfig{}
@@ -265,7 +265,7 @@ func WithVolumeMount(hostPath, containerPath string) ContainerOpts {
265265
}
266266
}
267267

268-
func WithWindowsUsername(username string) ContainerOpts { //nolint:unused
268+
func WithWindowsUsername(username string) ContainerOpts {
269269
return func(c *runtime.ContainerConfig) {
270270
if c.Windows == nil {
271271
c.Windows = &runtime.WindowsContainerConfig{}
@@ -277,7 +277,7 @@ func WithWindowsUsername(username string) ContainerOpts { //nolint:unused
277277
}
278278
}
279279

280-
func WithWindowsHostProcessContainer() ContainerOpts { //nolint:unused
280+
func WithWindowsHostProcessContainer() ContainerOpts {
281281
return func(c *runtime.ContainerConfig) {
282282
if c.Windows == nil {
283283
c.Windows = &runtime.WindowsContainerConfig{}
@@ -322,7 +322,7 @@ func WithLogPath(path string) ContainerOpts {
322322
}
323323

324324
// WithSupplementalGroups adds supplemental groups.
325-
func WithSupplementalGroups(gids []int64) ContainerOpts { //nolint:unused
325+
func WithSupplementalGroups(gids []int64) ContainerOpts {
326326
return func(c *runtime.ContainerConfig) {
327327
if c.Linux == nil {
328328
c.Linux = &runtime.LinuxContainerConfig{}
@@ -335,7 +335,7 @@ func WithSupplementalGroups(gids []int64) ContainerOpts { //nolint:unused
335335
}
336336

337337
// WithDevice adds a device mount.
338-
func WithDevice(containerPath, hostPath, permissions string) ContainerOpts { //nolint:unused
338+
func WithDevice(containerPath, hostPath, permissions string) ContainerOpts {
339339
return func(c *runtime.ContainerConfig) {
340340
c.Devices = append(c.Devices, &runtime.Device{
341341
ContainerPath: containerPath, HostPath: hostPath, Permissions: permissions,
@@ -558,7 +558,7 @@ func CRIConfig() (*criconfig.Config, error) {
558558
}
559559

560560
// SandboxInfo gets sandbox info.
561-
func SandboxInfo(id string) (*runtime.PodSandboxStatus, *server.SandboxInfo, error) { //nolint:unused
561+
func SandboxInfo(id string) (*runtime.PodSandboxStatus, *server.SandboxInfo, error) {
562562
client, err := RawRuntimeClient()
563563
if err != nil {
564564
return nil, nil, fmt.Errorf("failed to get raw runtime client: %w", err)

oci/spec_opts.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func setResources(s *Spec) {
8484
}
8585
}
8686

87-
//nolint:unused // not used on all platforms
87+
//nolint:nolintlint,unused // not used on all platforms
8888
func setResourcesWindows(s *Spec) {
8989
if s.Windows != nil {
9090
if s.Windows.Resources == nil {
@@ -93,7 +93,7 @@ func setResourcesWindows(s *Spec) {
9393
}
9494
}
9595

96-
//nolint:unused // not used on all platforms
96+
//nolint:nolintlint,unused // not used on all platforms
9797
func setCPU(s *Spec) {
9898
setResources(s)
9999
if s.Linux != nil {
@@ -103,7 +103,7 @@ func setCPU(s *Spec) {
103103
}
104104
}
105105

106-
//nolint:deadcode,unused // not used on all platforms
106+
//nolint:deadcode,nolintlint,unused // not used on all platforms
107107
func setCPUWindows(s *Spec) {
108108
setResourcesWindows(s)
109109
if s.Windows != nil {

oci/spec_opts_nonlinux.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,23 @@ import (
2828

2929
// WithAllCurrentCapabilities propagates the effective capabilities of the caller process to the container process.
3030
// The capability set may differ from WithAllKnownCapabilities when running in a container.
31-
//
32-
//nolint:unused
3331
var WithAllCurrentCapabilities = func(ctx context.Context, client Client, c *containers.Container, s *Spec) error {
3432
return WithCapabilities(nil)(ctx, client, c, s)
3533
}
3634

3735
// WithAllKnownCapabilities sets all the known linux capabilities for the container process
38-
//
39-
//nolint:unused
4036
var WithAllKnownCapabilities = func(ctx context.Context, client Client, c *containers.Container, s *Spec) error {
4137
return WithCapabilities(nil)(ctx, client, c, s)
4238
}
4339

4440
// WithBlockIO sets the container's blkio parameters
45-
//
46-
//nolint:unused
4741
func WithBlockIO(blockio interface{}) SpecOpts {
4842
return func(ctx context.Context, _ Client, c *containers.Container, s *Spec) error {
4943
return errors.New("blkio not supported")
5044
}
5145
}
5246

5347
// WithCPUShares sets the container's cpu shares
54-
//
55-
//nolint:unused
5648
func WithCPUShares(shares uint64) SpecOpts {
5749
return func(ctx context.Context, _ Client, c *containers.Container, s *Spec) error {
5850
return nil

oci/utils_unix.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func getDevices(path, containerPath string) ([]specs.LinuxDevice, error) {
127127

128128
// TODO consider adding these consts to the OCI runtime-spec.
129129
const (
130-
wildcardDevice = "a" //nolint:deadcode,unused,varcheck // currently unused, but should be included when upstreaming to OCI runtime-spec.
130+
wildcardDevice = "a" //nolint:deadcode,nolintlint,unused,varcheck // currently unused, but should be included when upstreaming to OCI runtime-spec.
131131
blockDevice = "b"
132132
charDevice = "c" // or "u"
133133
fifoDevice = "p"
@@ -148,7 +148,7 @@ func DeviceFromPath(path string) (*specs.LinuxDevice, error) {
148148
}
149149

150150
var (
151-
devNumber = uint64(stat.Rdev) //nolint:unconvert // the type is 32bit on mips.
151+
devNumber = uint64(stat.Rdev) //nolint:nolintlint,unconvert // the type is 32bit on mips.
152152
major = unix.Major(devNumber)
153153
minor = unix.Minor(devNumber)
154154
)

pkg/cri/sbserver/container_stats.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (c *criService) ContainerStats(ctx context.Context, in *runtime.ContainerSt
4141
}
4242

4343
cs, err := c.containerMetrics(cntr.Metadata, resp.Metrics[0])
44-
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (stats unimplemented)
44+
if err != nil {
4545
return nil, fmt.Errorf("failed to decode container metrics: %w", err)
4646
}
4747
return &runtime.ContainerStatsResponse{Stats: cs}, nil

pkg/cri/sbserver/container_stats_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (c *criService) toCRIContainerStats(
5858
containerStats := new(runtime.ListContainerStatsResponse)
5959
for _, cntr := range containers {
6060
cs, err := c.containerMetrics(cntr.Metadata, statsMap[cntr.ID])
61-
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (metrics unimplemented)
61+
if err != nil {
6262
return nil, fmt.Errorf("failed to decode container metrics for %q: %w", cntr.ID, err)
6363
}
6464
containerStats.Stats = append(containerStats.Stats, cs)

pkg/cri/sbserver/sandbox_stats.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ func (c *criService) PodSandboxStats(
3434
}
3535

3636
metrics, err := metricsForSandbox(sandbox)
37-
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
37+
if err != nil {
3838
return nil, fmt.Errorf("failed getting metrics for sandbox %s: %w", r.GetPodSandboxId(), err)
3939
}
4040

4141
podSandboxStats, err := c.podSandboxStats(ctx, sandbox, metrics)
42-
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
42+
if err != nil {
4343
return nil, fmt.Errorf("failed to decode pod sandbox metrics %s: %w", r.GetPodSandboxId(), err)
4444
}
4545

pkg/cri/sbserver/sandbox_stats_list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ func (c *criService) ListPodSandboxStats(
3434
podSandboxStats := new(runtime.ListPodSandboxStatsResponse)
3535
for _, sandbox := range sandboxes {
3636
metrics, err := metricsForSandbox(sandbox)
37-
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
37+
if err != nil {
3838
return nil, fmt.Errorf("failed to obtain metrics for sandbox %q: %w", sandbox.ID, err)
3939
}
4040

4141
sandboxStats, err := c.podSandboxStats(ctx, sandbox, metrics)
42-
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
42+
if err != nil {
4343
return nil, fmt.Errorf("failed to decode sandbox container metrics for sandbox %q: %w", sandbox.ID, err)
4444
}
4545
podSandboxStats.Stats = append(podSandboxStats.Stats, sandboxStats)

pkg/cri/sbserver/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ type criService struct {
117117
baseOCISpecs map[string]*oci.Spec
118118
// allCaps is the list of the capabilities.
119119
// When nil, parsed from CapEff of /proc/self/status.
120-
allCaps []string //nolint:unused // Ignore on non-Linux
120+
allCaps []string //nolint:nolintlint,unused // Ignore on non-Linux
121121
// unpackDuplicationSuppressor is used to make sure that there is only
122122
// one in-flight fetch request or unpack handler for a given descriptor's
123123
// or chain ID.

pkg/cri/server/container_stats.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (c *criService) ContainerStats(ctx context.Context, in *runtime.ContainerSt
4141
}
4242

4343
cs, err := c.containerMetrics(cntr.Metadata, resp.Metrics[0])
44-
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (stats unimplemented)
44+
if err != nil {
4545
return nil, fmt.Errorf("failed to decode container metrics: %w", err)
4646
}
4747
return &runtime.ContainerStatsResponse{Stats: cs}, nil

pkg/cri/server/container_stats_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (c *criService) toCRIContainerStats(
6161
containerStats := new(runtime.ListContainerStatsResponse)
6262
for _, cntr := range containers {
6363
cs, err := c.containerMetrics(cntr.Metadata, statsMap[cntr.ID])
64-
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (metrics unimplemented)
64+
if err != nil {
6565
return nil, fmt.Errorf("failed to decode container metrics for %q: %w", cntr.ID, err)
6666
}
6767

pkg/cri/server/sandbox_stats.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ func (c *criService) PodSandboxStats(
3434
}
3535

3636
metrics, err := metricsForSandbox(sandbox)
37-
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
37+
if err != nil {
3838
return nil, fmt.Errorf("failed getting metrics for sandbox %s: %w", r.GetPodSandboxId(), err)
3939
}
4040

4141
podSandboxStats, err := c.podSandboxStats(ctx, sandbox, metrics)
42-
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
42+
if err != nil {
4343
return nil, fmt.Errorf("failed to decode pod sandbox metrics %s: %w", r.GetPodSandboxId(), err)
4444
}
4545

pkg/cri/server/sandbox_stats_list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ func (c *criService) ListPodSandboxStats(
3434
podSandboxStats := new(runtime.ListPodSandboxStatsResponse)
3535
for _, sandbox := range sandboxes {
3636
metrics, err := metricsForSandbox(sandbox)
37-
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
37+
if err != nil {
3838
return nil, fmt.Errorf("failed to obtain metrics for sandbox %q: %w", sandbox.ID, err)
3939
}
4040

4141
sandboxStats, err := c.podSandboxStats(ctx, sandbox, metrics)
42-
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
42+
if err != nil {
4343
return nil, fmt.Errorf("failed to decode sandbox container metrics for sandbox %q: %w", sandbox.ID, err)
4444
}
4545
podSandboxStats.Stats = append(podSandboxStats.Stats, sandboxStats)

pkg/cri/server/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ type criService struct {
113113
baseOCISpecs map[string]*oci.Spec
114114
// allCaps is the list of the capabilities.
115115
// When nil, parsed from CapEff of /proc/self/status.
116-
allCaps []string //nolint:unused // Ignore on non-Linux
116+
allCaps []string //nolint:nolintlint,unused // Ignore on non-Linux
117117
// unpackDuplicationSuppressor is used to make sure that there is only
118118
// one in-flight fetch request or unpack handler for a given descriptor's
119119
// or chain ID.

pkg/cri/store/container/metadata.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ import (
2828
// 2) Metadata is checkpointed as containerd container label.
2929

3030
// metadataVersion is current version of container metadata.
31-
const metadataVersion = "v1" // nolint
31+
const metadataVersion = "v1"
3232

3333
// versionedMetadata is the internal versioned container metadata.
34-
// nolint
3534
type versionedMetadata struct {
3635
// Version indicates the version of the versioned container metadata.
3736
Version string

pkg/cri/store/container/status.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,9 @@ import (
6161
// DELETED
6262

6363
// statusVersion is current version of container status.
64-
const statusVersion = "v1" // nolint
64+
const statusVersion = "v1"
6565

6666
// versionedStatus is the internal used versioned container status.
67-
// nolint
6867
type versionedStatus struct {
6968
// Version indicates the version of the versioned container status.
7069
Version string

pkg/cri/store/sandbox/metadata.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ import (
2929
// 2) Metadata is checkpointed as containerd container label.
3030

3131
// metadataVersion is current version of sandbox metadata.
32-
const metadataVersion = "v1" // nolint
32+
const metadataVersion = "v1"
3333

3434
// versionedMetadata is the internal versioned sandbox metadata.
35-
// nolint
3635
type versionedMetadata struct {
3736
// Version indicates the version of the versioned sandbox metadata.
3837
Version string

pkg/progress/escape.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ package progress
1919
const (
2020
escape = "\x1b"
2121
reset = escape + "[0m"
22-
red = escape + "[31m" //nolint:deadcode,unused,varcheck
22+
red = escape + "[31m" //nolint:deadcode,nolintlint,unused,varcheck
2323
green = escape + "[32m"
2424
)

0 commit comments

Comments
 (0)