clean-up "nolint" comments, remove unused ones

- fix "nolint" comments to be in the correct format (`//nolint:<linters>[,<linter>`
  no leading space, required colon (`:`) and linters.
- remove "nolint" comments for errcheck, which is disabled in our config.
- remove "nolint" comments that were no longer needed (nolintlint).
- where known, add a comment describing why a "nolint" was applied.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2022-08-30 23:05:52 +02:00
parent d215725136
commit 29c7fc9520
16 changed files with 30 additions and 29 deletions

View File

@@ -83,7 +83,7 @@ func WithVolumes(volumeMounts map[string]string) containerd.NewContainerOpts {
// if it fails but not RM snapshot data.
// refer to https://github.com/containerd/containerd/pull/1868
// https://github.com/containerd/containerd/pull/1785
defer os.Remove(root) // nolint: errcheck
defer os.Remove(root)
unmounter := func(mountPath string) {
if uerr := mount.Unmount(mountPath, 0); uerr != nil {

View File

@@ -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
allCaps []string //nolint: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.

View File

@@ -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
allCaps []string //nolint: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.

View File

@@ -208,6 +208,6 @@ func (s *Store) Delete(id string) {
c.IO.Close()
}
s.labels.Release(c.ProcessLabel)
s.idIndex.Delete(id) // nolint: errcheck
s.idIndex.Delete(id)
delete(s.containers, id)
}

View File

@@ -246,6 +246,6 @@ func (s *store) delete(id, ref string) {
return
}
// Remove the image if it is not referenced any more.
s.digestSet.Remove(digest) // nolint: errcheck
s.digestSet.Remove(digest)
delete(s.images, digest.String())
}

View File

@@ -160,6 +160,6 @@ func (s *Store) Delete(id string) {
return
}
s.labels.Release(s.sandboxes[id].ProcessLabel)
s.idIndex.Delete(id) // nolint: errcheck
s.idIndex.Delete(id)
delete(s.sandboxes, id)
}

View File

@@ -77,7 +77,7 @@ func newNS(baseDir string) (nsPath string, err error) {
defer func() {
// Ensure the mount point is cleaned up on errors
if err != nil {
os.RemoveAll(nsPath) // nolint: errcheck
os.RemoveAll(nsPath)
}
}()
@@ -107,7 +107,7 @@ func newNS(baseDir string) (nsPath string, err error) {
}
// Put this thread back to the orig ns, since it might get reused (pre go1.10)
defer origNS.Set() // nolint: errcheck
defer origNS.Set()
// bind mount the netns from the current thread (from /proc) onto the
// mount point. This causes the namespace to persist, even when there
@@ -214,6 +214,6 @@ func (n *NetNS) Do(f func(cnins.NetNS) error) error {
if err != nil {
return fmt.Errorf("get netns fd: %w", err)
}
defer ns.Close() // nolint: errcheck
defer ns.Close()
return ns.Do(f)
}

View File

@@ -19,6 +19,6 @@ package progress
const (
escape = "\x1b"
reset = escape + "[0m"
red = escape + "[31m" // nolint: deadcode, varcheck, unused
red = escape + "[31m" //nolint:deadcode,unused,varcheck
green = escape + "[32m"
)

View File

@@ -14,4 +14,4 @@
limitations under the License.
*/
package runtimeoptions_v1 //nolint
package runtimeoptions_v1 //nolint:revive // Ignore var-naming: don't use an underscore in package name (revive)