Skip to content

Commit e6179af

Browse files
committed
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]> (cherry picked from commit f9c80be) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 77160e6 commit e6179af

15 files changed

Lines changed: 22 additions & 32 deletions

File tree

.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
@@ -62,7 +62,7 @@ func setHeaderForSpecialDevice(hdr *tar.Header, name string, fi os.FileInfo) err
6262
return errors.New("unsupported stat type")
6363
}
6464

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

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

integration/main_test.go

Lines changed: 6 additions & 6 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{}
@@ -255,7 +255,7 @@ func WithVolumeMount(hostPath, containerPath string) ContainerOpts {
255255
}
256256
}
257257

258-
func WithWindowsUsername(username string) ContainerOpts { //nolint:unused
258+
func WithWindowsUsername(username string) ContainerOpts {
259259
return func(c *runtime.ContainerConfig) {
260260
if c.Windows == nil {
261261
c.Windows = &runtime.WindowsContainerConfig{}
@@ -267,7 +267,7 @@ func WithWindowsUsername(username string) ContainerOpts { //nolint:unused
267267
}
268268
}
269269

270-
func WithWindowsHostProcessContainer() ContainerOpts { //nolint:unused
270+
func WithWindowsHostProcessContainer() ContainerOpts {
271271
return func(c *runtime.ContainerConfig) {
272272
if c.Windows == nil {
273273
c.Windows = &runtime.WindowsContainerConfig{}
@@ -351,7 +351,7 @@ func WithRunAsGroup(gid int64) ContainerOpts {
351351
}
352352

353353
// WithSupplementalGroups adds supplemental groups.
354-
func WithSupplementalGroups(gids []int64) ContainerOpts { //nolint:unused
354+
func WithSupplementalGroups(gids []int64) ContainerOpts {
355355
return func(c *runtime.ContainerConfig) {
356356
if c.Linux == nil {
357357
c.Linux = &runtime.LinuxContainerConfig{}
@@ -574,7 +574,7 @@ func CRIConfig() (*criconfig.Config, error) {
574574
}
575575

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

oci/spec_opts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func setResources(s *Spec) {
8989
}
9090
}
9191

92-
//nolint:unused // not used on all platforms
92+
//nolint:nolintlint,unused // not used on all platforms
9393
func setCPU(s *Spec) {
9494
setResources(s)
9595
if s.Linux != nil {

oci/spec_opts_nonlinux.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,16 @@ 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
// WithCPUShares sets the container's cpu shares
45-
//
46-
//nolint:unused
4741
func WithCPUShares(shares uint64) SpecOpts {
4842
return func(ctx context.Context, _ Client, c *containers.Container, s *Spec) error {
4943
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/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
@@ -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/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)

0 commit comments

Comments
 (0)