You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The arkade repository is becoming bigger, and it's recommended to follow some linting rules as a standard. There are static analysis tools that can take of that.
Using a linter is a best practice and might even find some bugs.
Running golangci-lint on arkade
➜ arkade git:(master) golangci-lint run ./...
pkg/archive/untar.go:116:6: `validRelativeDir` is unused (deadcode)
func validRelativeDir(dir string) bool {
^
pkg/archive/unzip.go:25:15: copylocks: call of unzip copies lock value: archive/zip.Reader contains sync.Once contains sync.Mutex (govet)
return unzip(*zipReader, dir, quiet)
^
pkg/archive/unzip.go:28:14: copylocks: unzip passes lock by value: archive/zip.Reader contains sync.Once contains sync.Mutex (govet)
func unzip(r zip.Reader, dir string, quiet bool) (err error) {
^
cmd/apps/minio_app.go:152:8: `clientOS` is unused (deadcode)
var _, clientOS = env.GetClientArch()
^
cmd/apps/osm_app.go:163:5: `osmInstallMsg` is unused (deadcode)
var osmInstallMsg = `======================================================================= ^pkg/get/get.go:373:10: Error return value of `t.Parse` is not checked (errcheck) t.Parse(`Run the following to copy to install the tool: ^pkg/get/get.go:381:10: Error return value of `t.Parse` is not checked (errcheck) t.Parse(`# Add arkade binary directory to your PATH variable ^cmd/apps/metallb_app.go:80:13: Error return value of `rand.Read` is not checked (errcheck) rand.Read(randomToken) ^cmd/apps/of_loki.go:63:14: Error return value of `k8s.Kubectl` is not checked (errcheck) k8s.Kubectl("-n", openfaasNamespace, ^cmd/apps/openfaas_app.go:297:12: Error return value of `pem.Encode` is not checked (errcheck) pem.Encode(&privOut, &pem.Block{Type: "EC PRIVATE KEY", Bytes: ecder}) ^cmd/apps/openfaas_app.go:306:12: Error return value of `pem.Encode` is not checked (errcheck) pem.Encode(&pubOut, &pem.Block{Type: "PUBLIC KEY", Bytes: pubder}) ^cmd/completion.go:57:32: Error return value of `(*github.com/spf13/cobra.Command).GenBashCompletion` is not checked (errcheck)cmd.Root().GenBashCompletion(os.Stdout) ^cmd/completion.go:61:32: Error return value of `(*github.com/spf13/cobra.Command).GenFishCompletion` is not checked (errcheck)cmd.Root().GenFishCompletion(os.Stdout, true) ^cmd/completion.go:63:38: Error return value of `(*github.com/spf13/cobra.Command).GenPowerShellCompletion` is not checked (errcheck)cmd.Root().GenPowerShellCompletion(os.Stdout) ^cmd/completion.go:77:31: Error return value of `(*github.com/spf13/cobra.Command).GenZshCompletion` is not checked (errcheck) rootCmd(cmd).GenZshCompletion(out) ^cmd/completion.go:78:16: Error return value of `io.WriteString` is not checked (errcheck) io.WriteString(out, zshCompdef) ^main.go:22:12: Error return value of `cmd.Help` is not checked (errcheck)cmd.Help() ^cmd/apps/inletsoperator_app.go:176:9: S1002: should omit comparison to bool constant, can be simplified to `!fileFlagChanged` (gosimple)if fileFlagChanged == false { ^cmd/apps/openfaas_app.go:192:6: S1002: should omit comparison to bool constant, can be simplified to `!basicAuthEnabled` (gosimple)if basicAuthEnabled == false { ^pkg/get/download.go:63:68: S1002: should omit comparison to bool constant, can be simplified to `!tool.NoExtension` (gosimple)if strings.Contains(strings.ToLower(operatingSystem), "mingw") && tool.NoExtension == false { ^pkg/get/download.go:201:68: S1002: should omit comparison to bool constant, can be simplified to `!tool.NoExtension` (gosimple)if strings.Contains(strings.ToLower(operatingSystem), "mingw") && tool.NoExtension == false { ^cmd/apps/linkerd_app.go:169:16: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) Command: fmt.Sprintf("%s", env.LocalBinary("linkerd2", "")), ^cmd/apps/osm_app.go:126:16: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) Command: fmt.Sprintf("%s", env.LocalBinary("osm", "")), ^pkg/get/get_test.go:143:11: S1025: the argument's underlying type is a slice of bytes, should use a simple conversion instead of fmt.Sprintf (gosimple) got := fmt.Sprintf("%s", msg) ^pkg/helm/helm.go:93:16: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) Command: fmt.Sprintf("%s", env.LocalBinary("helm", subdir)), ^cmd/apps/openfaas_app.go:276:3: S1023: redundant break statement (gosimple)break ^cmd/apps/openfaas_app.go:279:3: S1023: redundant break statement (gosimple)break ^cmd/apps/minio_app.go:113:15: ineffectual assignment to err (ineffassign) accessKey, err = gen.Generate(20, 10, 0, false, true) ^cmd/apps/minio_app.go:117:15: ineffectual assignment to err (ineffassign) secretKey, err = gen.Generate(40, 10, 5, false, true) ^cmd/apps/openfaas_ingress_app.go:173:3: SA1006: printf-style functionwith dynamic format string and no further arguments should use print-style functioninstead (staticcheck) log.Printf(tempDirectory) ^cmd/apps/registry_app.go:155:4: SA1006: printf-style functionwith dynamic format string and no further arguments should use print-style functioninstead (staticcheck) fmt.Printf(fmt.Sprintf("Registry credentials: %s %s\nexport PASSWORD=%s\n", username, pass, pass))
Expected Behaviour
Fail CI on linting errors
Current Behaviour
No static analysis validations.
Are you a GitHub Sponsor yet (Yes/No?)
Possible Solution
Use https://github.com/golangci/golangci-lint as
make lint
.Context
The
arkade
repository is becoming bigger, and it's recommended to follow some linting rules as a standard. There are static analysis tools that can take of that.Using a linter is a best practice and might even find some bugs.
Running golangci-lint on arkade
Your Environment
The text was updated successfully, but these errors were encountered: