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 https://github.com/golangci/golangci-lint/issues/2649.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
			
			
This commit is contained in:
		| @@ -6,13 +6,12 @@ linters: | ||||
|     - gosec | ||||
|     - ineffassign | ||||
|     - misspell | ||||
|     - nolintlint | ||||
|     - revive | ||||
|     - staticcheck | ||||
|     - structcheck | ||||
|     - tenv # Detects using os.Setenv instead of t.Setenv since Go 1.17 | ||||
|     - unconvert | ||||
|     - unused | ||||
|     - varcheck | ||||
|     - vet | ||||
|   disable: | ||||
|     - errcheck | ||||
|   | ||||
| @@ -58,7 +58,7 @@ func setHeaderForSpecialDevice(hdr *tar.Header, name string, fi os.FileInfo) err | ||||
| 		return errors.New("unsupported stat type") | ||||
| 	} | ||||
|  | ||||
| 	rdev := uint64(s.Rdev) //nolint:unconvert // rdev is int32 on darwin/bsd, int64 on linux/solaris | ||||
| 	rdev := uint64(s.Rdev) //nolint:nolintlint,unconvert // rdev is int32 on darwin/bsd, int64 on linux/solaris | ||||
|  | ||||
| 	// Currently go does not fill in the major/minors | ||||
| 	if s.Mode&syscall.S_IFBLK != 0 || | ||||
|   | ||||
| @@ -210,7 +210,7 @@ func PodSandboxConfigWithCleanup(t *testing.T, name, ns string, opts ...PodSandb | ||||
| } | ||||
|  | ||||
| // Set Windows HostProcess on the pod. | ||||
| func WithWindowsHostProcessPod(p *runtime.PodSandboxConfig) { //nolint:unused | ||||
| func WithWindowsHostProcessPod(p *runtime.PodSandboxConfig) { | ||||
| 	if p.Windows == nil { | ||||
| 		p.Windows = &runtime.WindowsPodSandboxConfig{} | ||||
| 	} | ||||
| @@ -237,7 +237,7 @@ func WithTestAnnotations() ContainerOpts { | ||||
| } | ||||
|  | ||||
| // Add container resource limits. | ||||
| func WithResources(r *runtime.LinuxContainerResources) ContainerOpts { //nolint:unused | ||||
| func WithResources(r *runtime.LinuxContainerResources) ContainerOpts { | ||||
| 	return func(c *runtime.ContainerConfig) { | ||||
| 		if c.Linux == nil { | ||||
| 			c.Linux = &runtime.LinuxContainerConfig{} | ||||
| @@ -247,7 +247,7 @@ func WithResources(r *runtime.LinuxContainerResources) ContainerOpts { //nolint: | ||||
| } | ||||
|  | ||||
| // Adds Windows container resource limits. | ||||
| func WithWindowsResources(r *runtime.WindowsContainerResources) ContainerOpts { //nolint:unused | ||||
| func WithWindowsResources(r *runtime.WindowsContainerResources) ContainerOpts { | ||||
| 	return func(c *runtime.ContainerConfig) { | ||||
| 		if c.Windows == nil { | ||||
| 			c.Windows = &runtime.WindowsContainerConfig{} | ||||
| @@ -265,7 +265,7 @@ func WithVolumeMount(hostPath, containerPath string) ContainerOpts { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func WithWindowsUsername(username string) ContainerOpts { //nolint:unused | ||||
| func WithWindowsUsername(username string) ContainerOpts { | ||||
| 	return func(c *runtime.ContainerConfig) { | ||||
| 		if c.Windows == nil { | ||||
| 			c.Windows = &runtime.WindowsContainerConfig{} | ||||
| @@ -277,7 +277,7 @@ func WithWindowsUsername(username string) ContainerOpts { //nolint:unused | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func WithWindowsHostProcessContainer() ContainerOpts { //nolint:unused | ||||
| func WithWindowsHostProcessContainer() ContainerOpts { | ||||
| 	return func(c *runtime.ContainerConfig) { | ||||
| 		if c.Windows == nil { | ||||
| 			c.Windows = &runtime.WindowsContainerConfig{} | ||||
| @@ -322,7 +322,7 @@ func WithLogPath(path string) ContainerOpts { | ||||
| } | ||||
|  | ||||
| // WithSupplementalGroups adds supplemental groups. | ||||
| func WithSupplementalGroups(gids []int64) ContainerOpts { //nolint:unused | ||||
| func WithSupplementalGroups(gids []int64) ContainerOpts { | ||||
| 	return func(c *runtime.ContainerConfig) { | ||||
| 		if c.Linux == nil { | ||||
| 			c.Linux = &runtime.LinuxContainerConfig{} | ||||
| @@ -335,7 +335,7 @@ func WithSupplementalGroups(gids []int64) ContainerOpts { //nolint:unused | ||||
| } | ||||
|  | ||||
| // WithDevice adds a device mount. | ||||
| func WithDevice(containerPath, hostPath, permissions string) ContainerOpts { //nolint:unused | ||||
| func WithDevice(containerPath, hostPath, permissions string) ContainerOpts { | ||||
| 	return func(c *runtime.ContainerConfig) { | ||||
| 		c.Devices = append(c.Devices, &runtime.Device{ | ||||
| 			ContainerPath: containerPath, HostPath: hostPath, Permissions: permissions, | ||||
| @@ -558,7 +558,7 @@ func CRIConfig() (*criconfig.Config, error) { | ||||
| } | ||||
|  | ||||
| // SandboxInfo gets sandbox info. | ||||
| func SandboxInfo(id string) (*runtime.PodSandboxStatus, *server.SandboxInfo, error) { //nolint:unused | ||||
| func SandboxInfo(id string) (*runtime.PodSandboxStatus, *server.SandboxInfo, error) { | ||||
| 	client, err := RawRuntimeClient() | ||||
| 	if err != nil { | ||||
| 		return nil, nil, fmt.Errorf("failed to get raw runtime client: %w", err) | ||||
|   | ||||
| @@ -84,7 +84,7 @@ func setResources(s *Spec) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| //nolint:unused // not used on all platforms | ||||
| //nolint:nolintlint,unused // not used on all platforms | ||||
| func setResourcesWindows(s *Spec) { | ||||
| 	if s.Windows != nil { | ||||
| 		if s.Windows.Resources == nil { | ||||
| @@ -93,7 +93,7 @@ func setResourcesWindows(s *Spec) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| //nolint:unused // not used on all platforms | ||||
| //nolint:nolintlint,unused // not used on all platforms | ||||
| func setCPU(s *Spec) { | ||||
| 	setResources(s) | ||||
| 	if s.Linux != nil { | ||||
| @@ -103,7 +103,7 @@ func setCPU(s *Spec) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| //nolint:deadcode,unused // not used on all platforms | ||||
| //nolint:deadcode,nolintlint,unused // not used on all platforms | ||||
| func setCPUWindows(s *Spec) { | ||||
| 	setResourcesWindows(s) | ||||
| 	if s.Windows != nil { | ||||
|   | ||||
| @@ -28,22 +28,16 @@ import ( | ||||
|  | ||||
| // WithAllCurrentCapabilities propagates the effective capabilities of the caller process to the container process. | ||||
| // The capability set may differ from WithAllKnownCapabilities when running in a container. | ||||
| // | ||||
| //nolint:unused | ||||
| var WithAllCurrentCapabilities = func(ctx context.Context, client Client, c *containers.Container, s *Spec) error { | ||||
| 	return WithCapabilities(nil)(ctx, client, c, s) | ||||
| } | ||||
|  | ||||
| // WithAllKnownCapabilities sets all the known linux capabilities for the container process | ||||
| // | ||||
| //nolint:unused | ||||
| var WithAllKnownCapabilities = func(ctx context.Context, client Client, c *containers.Container, s *Spec) error { | ||||
| 	return WithCapabilities(nil)(ctx, client, c, s) | ||||
| } | ||||
|  | ||||
| // WithBlockIO sets the container's blkio parameters | ||||
| // | ||||
| //nolint:unused | ||||
| func WithBlockIO(blockio interface{}) SpecOpts { | ||||
| 	return func(ctx context.Context, _ Client, c *containers.Container, s *Spec) error { | ||||
| 		return errors.New("blkio not supported") | ||||
| @@ -51,8 +45,6 @@ func WithBlockIO(blockio interface{}) SpecOpts { | ||||
| } | ||||
|  | ||||
| // WithCPUShares sets the container's cpu shares | ||||
| // | ||||
| //nolint:unused | ||||
| func WithCPUShares(shares uint64) SpecOpts { | ||||
| 	return func(ctx context.Context, _ Client, c *containers.Container, s *Spec) error { | ||||
| 		return nil | ||||
|   | ||||
| @@ -127,7 +127,7 @@ func getDevices(path, containerPath string) ([]specs.LinuxDevice, error) { | ||||
|  | ||||
| // TODO consider adding these consts to the OCI runtime-spec. | ||||
| const ( | ||||
| 	wildcardDevice = "a" //nolint:deadcode,unused,varcheck // currently unused, but should be included when upstreaming to OCI runtime-spec. | ||||
| 	wildcardDevice = "a" //nolint:deadcode,nolintlint,unused,varcheck // currently unused, but should be included when upstreaming to OCI runtime-spec. | ||||
| 	blockDevice    = "b" | ||||
| 	charDevice     = "c" // or "u" | ||||
| 	fifoDevice     = "p" | ||||
| @@ -148,7 +148,7 @@ func DeviceFromPath(path string) (*specs.LinuxDevice, error) { | ||||
| 	} | ||||
|  | ||||
| 	var ( | ||||
| 		devNumber = uint64(stat.Rdev) //nolint:unconvert // the type is 32bit on mips. | ||||
| 		devNumber = uint64(stat.Rdev) //nolint:nolintlint,unconvert // the type is 32bit on mips. | ||||
| 		major     = unix.Major(devNumber) | ||||
| 		minor     = unix.Minor(devNumber) | ||||
| 	) | ||||
|   | ||||
| @@ -41,7 +41,7 @@ func (c *criService) ContainerStats(ctx context.Context, in *runtime.ContainerSt | ||||
| 	} | ||||
|  | ||||
| 	cs, err := c.containerMetrics(cntr.Metadata, resp.Metrics[0]) | ||||
| 	if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (stats unimplemented) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to decode container metrics: %w", err) | ||||
| 	} | ||||
| 	return &runtime.ContainerStatsResponse{Stats: cs}, nil | ||||
|   | ||||
| @@ -58,7 +58,7 @@ func (c *criService) toCRIContainerStats( | ||||
| 	containerStats := new(runtime.ListContainerStatsResponse) | ||||
| 	for _, cntr := range containers { | ||||
| 		cs, err := c.containerMetrics(cntr.Metadata, statsMap[cntr.ID]) | ||||
| 		if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (metrics unimplemented) | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf("failed to decode container metrics for %q: %w", cntr.ID, err) | ||||
| 		} | ||||
| 		containerStats.Stats = append(containerStats.Stats, cs) | ||||
|   | ||||
| @@ -34,12 +34,12 @@ func (c *criService) PodSandboxStats( | ||||
| 	} | ||||
|  | ||||
| 	metrics, err := metricsForSandbox(sandbox) | ||||
| 	if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed getting metrics for sandbox %s: %w", r.GetPodSandboxId(), err) | ||||
| 	} | ||||
|  | ||||
| 	podSandboxStats, err := c.podSandboxStats(ctx, sandbox, metrics) | ||||
| 	if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to decode pod sandbox metrics %s: %w", r.GetPodSandboxId(), err) | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -34,12 +34,12 @@ func (c *criService) ListPodSandboxStats( | ||||
| 	podSandboxStats := new(runtime.ListPodSandboxStatsResponse) | ||||
| 	for _, sandbox := range sandboxes { | ||||
| 		metrics, err := metricsForSandbox(sandbox) | ||||
| 		if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics) | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf("failed to obtain metrics for sandbox %q: %w", sandbox.ID, err) | ||||
| 		} | ||||
|  | ||||
| 		sandboxStats, err := c.podSandboxStats(ctx, sandbox, metrics) | ||||
| 		if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics) | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf("failed to decode sandbox container metrics for sandbox %q: %w", sandbox.ID, err) | ||||
| 		} | ||||
| 		podSandboxStats.Stats = append(podSandboxStats.Stats, sandboxStats) | ||||
|   | ||||
| @@ -117,7 +117,7 @@ type criService struct { | ||||
| 	baseOCISpecs map[string]*oci.Spec | ||||
| 	// allCaps is the list of the capabilities. | ||||
| 	// When nil, parsed from CapEff of /proc/self/status. | ||||
| 	allCaps []string //nolint:unused // Ignore on non-Linux | ||||
| 	allCaps []string //nolint:nolintlint,unused // Ignore on non-Linux | ||||
| 	// unpackDuplicationSuppressor is used to make sure that there is only | ||||
| 	// one in-flight fetch request or unpack handler for a given descriptor's | ||||
| 	// or chain ID. | ||||
|   | ||||
| @@ -41,7 +41,7 @@ func (c *criService) ContainerStats(ctx context.Context, in *runtime.ContainerSt | ||||
| 	} | ||||
|  | ||||
| 	cs, err := c.containerMetrics(cntr.Metadata, resp.Metrics[0]) | ||||
| 	if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (stats unimplemented) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to decode container metrics: %w", err) | ||||
| 	} | ||||
| 	return &runtime.ContainerStatsResponse{Stats: cs}, nil | ||||
|   | ||||
| @@ -61,7 +61,7 @@ func (c *criService) toCRIContainerStats( | ||||
| 	containerStats := new(runtime.ListContainerStatsResponse) | ||||
| 	for _, cntr := range containers { | ||||
| 		cs, err := c.containerMetrics(cntr.Metadata, statsMap[cntr.ID]) | ||||
| 		if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (metrics unimplemented) | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf("failed to decode container metrics for %q: %w", cntr.ID, err) | ||||
| 		} | ||||
|  | ||||
|   | ||||
| @@ -34,12 +34,12 @@ func (c *criService) PodSandboxStats( | ||||
| 	} | ||||
|  | ||||
| 	metrics, err := metricsForSandbox(sandbox) | ||||
| 	if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed getting metrics for sandbox %s: %w", r.GetPodSandboxId(), err) | ||||
| 	} | ||||
|  | ||||
| 	podSandboxStats, err := c.podSandboxStats(ctx, sandbox, metrics) | ||||
| 	if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to decode pod sandbox metrics %s: %w", r.GetPodSandboxId(), err) | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -34,12 +34,12 @@ func (c *criService) ListPodSandboxStats( | ||||
| 	podSandboxStats := new(runtime.ListPodSandboxStatsResponse) | ||||
| 	for _, sandbox := range sandboxes { | ||||
| 		metrics, err := metricsForSandbox(sandbox) | ||||
| 		if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics) | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf("failed to obtain metrics for sandbox %q: %w", sandbox.ID, err) | ||||
| 		} | ||||
|  | ||||
| 		sandboxStats, err := c.podSandboxStats(ctx, sandbox, metrics) | ||||
| 		if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics) | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf("failed to decode sandbox container metrics for sandbox %q: %w", sandbox.ID, err) | ||||
| 		} | ||||
| 		podSandboxStats.Stats = append(podSandboxStats.Stats, sandboxStats) | ||||
|   | ||||
| @@ -113,7 +113,7 @@ type criService struct { | ||||
| 	baseOCISpecs map[string]*oci.Spec | ||||
| 	// allCaps is the list of the capabilities. | ||||
| 	// When nil, parsed from CapEff of /proc/self/status. | ||||
| 	allCaps []string //nolint:unused // Ignore on non-Linux | ||||
| 	allCaps []string //nolint:nolintlint,unused // Ignore on non-Linux | ||||
| 	// unpackDuplicationSuppressor is used to make sure that there is only | ||||
| 	// one in-flight fetch request or unpack handler for a given descriptor's | ||||
| 	// or chain ID. | ||||
|   | ||||
| @@ -28,10 +28,9 @@ import ( | ||||
| // 2) Metadata is checkpointed as containerd container label. | ||||
|  | ||||
| // metadataVersion is current version of container metadata. | ||||
| const metadataVersion = "v1" // nolint | ||||
| const metadataVersion = "v1" | ||||
|  | ||||
| // versionedMetadata is the internal versioned container metadata. | ||||
| // nolint | ||||
| type versionedMetadata struct { | ||||
| 	// Version indicates the version of the versioned container metadata. | ||||
| 	Version string | ||||
|   | ||||
| @@ -61,10 +61,9 @@ import ( | ||||
| //                      DELETED | ||||
|  | ||||
| // statusVersion is current version of container status. | ||||
| const statusVersion = "v1" // nolint | ||||
| const statusVersion = "v1" | ||||
|  | ||||
| // versionedStatus is the internal used versioned container status. | ||||
| // nolint | ||||
| type versionedStatus struct { | ||||
| 	// Version indicates the version of the versioned container status. | ||||
| 	Version string | ||||
|   | ||||
| @@ -29,10 +29,9 @@ import ( | ||||
| // 2) Metadata is checkpointed as containerd container label. | ||||
|  | ||||
| // metadataVersion is current version of sandbox metadata. | ||||
| const metadataVersion = "v1" // nolint | ||||
| const metadataVersion = "v1" | ||||
|  | ||||
| // versionedMetadata is the internal versioned sandbox metadata. | ||||
| // nolint | ||||
| type versionedMetadata struct { | ||||
| 	// Version indicates the version of the versioned sandbox metadata. | ||||
| 	Version string | ||||
|   | ||||
| @@ -19,6 +19,6 @@ package progress | ||||
| const ( | ||||
| 	escape = "\x1b" | ||||
| 	reset  = escape + "[0m" | ||||
| 	red    = escape + "[31m" //nolint:deadcode,unused,varcheck | ||||
| 	red    = escape + "[31m" //nolint:deadcode,nolintlint,unused,varcheck | ||||
| 	green  = escape + "[32m" | ||||
| ) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sebastiaan van Stijn
					Sebastiaan van Stijn