DopplerHQ / cli

The official CLI for interacting with your Doppler secrets and configuration.
https://docs.doppler.com
Apache License 2.0
214 stars 43 forks source link

ENG-5298: Fix deprecations and clean up cli code #342

Closed Kunamatata closed 1 year ago

Kunamatata commented 1 year ago

Description

This PR addresses warnings and suggestions made by staticcheck as well as go vet

Suggestion / Recommendation

We should incorporate linters such as staticcheck or golangci-lint (which is an aggregation of linters which contains staticcheck) and go vet to our github CI actions

We should address the golangci-lint results below as well but I want to start this conversation instead of fixing those right now.

golangci-lint example

Here is an example of golangci-lint run ./.... ⚠️ These are not currently covered by this PR

❯ golangci-lint run ./...                                                                                                                                                       15:29:28
pkg/printer/print.go:121:4: S1038: should use fmt.Printf instead of fmt.Println(fmt.Sprintf(...)) (but don't forget the newline) (gosimple)
                        fmt.Println(fmt.Sprintf("· %s", change))
                        ^
pkg/cmd/secrets.go:37:6: type `secretsResponse` is unused (unused)
type secretsResponse struct {
     ^
pkg/cmd/secrets.go:469:3: ineffectual assignment to enableFallback (ineffassign)
                enableFallback = false
                ^
pkg/cmd/secrets.go:470:3: ineffectual assignment to enableCache (ineffassign)
                enableCache = false
                ^
pkg/utils/random.go:29:11: Error return value of `rand.Read` is not checked (errcheck)
        rand.Read(buffer) // #nosec G104
                 ^
pkg/utils/util.go:165:23: Error return value of `cmd.Process.Signal` is not checked (errcheck)
                                cmd.Process.Signal(sig) // #nosec G104
                                                  ^
pkg/utils/util.go:175:21: Error return value of `cmd.Process.Signal` is not checked (errcheck)
                cmd.Process.Signal(os.Kill) // #nosec G104
                                  ^