UNCLASSIFIED - NO CUI

Skip to content

Draft: all: clean up lints

Daniel Dides requested to merge dd/lints into main

General MR

Summary

Ran make lint and resolved any lints that occurred. For the most part, it was just unchecked error return values. This should allow us to integrate make lint into our standard dev processes now.

There was one exception related to the fake_factory test values that I have noted below in a thread that should be confirmed.

Relevant logs/screenshots

Lints before this:

cmd/values_test.go:54:10: Error return value is not checked (errcheck)
	cmd.RunE(cmd, []string{"foo"})
	        ^
cmd/deploy/root.go:38:22: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
				validCommands += fmt.Sprintf("%s", subCmd.Use)
				                 ^
util/factory.go:357:19: Error return value of `actionConfig.Init` is not checked (errcheck)
	actionConfig.Init(
	                 ^
util/factory_test.go:30:11: Error return value of `os.Rename` is not checked (errcheck)
	os.Rename(path.Join(credsDir, "credentials.yaml"), path.Join(credsDir, "old-credentials.yaml"))
	         ^
util/factory_test.go:40:11: Error return value of `os.Rename` is not checked (errcheck)
	os.Rename(path.Join(credsDir, "old-credentials.yaml"), path.Join(credsDir, "credentials.yaml"))
	         ^
util/factory_test.go:194:11: Error return value of `os.Rename` is not checked (errcheck)
	os.Rename(path.Join(credsDir, "credentials.yaml"), path.Join(credsDir, "old-credentials.yaml"))
	         ^
static/constants.go:12:2: var `constants` is unused (unused)
	constants = Constants{}
	^
util/test/fake_factory_helper.go:111:4: SA4005: ineffective assignment to field badResource.MockPolicyNotFound (staticcheck)
			b.MockPolicyNotFound = false
			^
util/test/fake_factory_helper.go:90:3: SA4005: ineffective assignment to field badResource.MockCrds (staticcheck)
		b.MockCrds = false

Linked Issue

N/A

Upgrade Notices

N/A

Merge request reports