diff --git a/.github/dependencies.txt b/.github/dependencies.txt index 6a7cdea61..63ca73e9f 100644 --- a/.github/dependencies.txt +++ b/.github/dependencies.txt @@ -2,4 +2,4 @@ github.com/goreleaser/goreleaser/v2@latest github.com/mgechev/revive@latest github.com/securego/gosec/v2/cmd/gosec@latest golang.org/x/tools/cmd/goimports@latest -honnef.co/go/tools/cmd/staticcheck@2023.1.7 +honnef.co/go/tools/cmd/staticcheck@latest diff --git a/pkg/commands/compute/init.go b/pkg/commands/compute/init.go index ca4fce0f3..46d4f054f 100644 --- a/pkg/commands/compute/init.go +++ b/pkg/commands/compute/init.go @@ -820,12 +820,12 @@ func validateTemplateOptionOrURL(templates []config.StarterKit) func(string) err } if option, err := strconv.Atoi(input); err == nil { if option > len(templates) { - return fmt.Errorf(msg) + return errors.New(msg) } return nil } if !gitRepositoryRegEx.MatchString(input) { - return fmt.Errorf(msg) + return errors.New(msg) } return nil } diff --git a/pkg/commands/logtail/root.go b/pkg/commands/logtail/root.go index 5efb431ea..2c2ed3d24 100644 --- a/pkg/commands/logtail/root.go +++ b/pkg/commands/logtail/root.go @@ -652,11 +652,11 @@ func findIdxBySeq(logs []Log, seq int) int { // highSequence returns the highest SequenceNum // in a slice of logs. func highSequence(logs []Log) int { - var max int + var maximum int for _, l := range logs { - if l.SequenceNum > max { - max = l.SequenceNum + if l.SequenceNum > maximum { + maximum = l.SequenceNum } } - return max + return maximum } diff --git a/pkg/commands/profile/list.go b/pkg/commands/profile/list.go index b771fcc6b..fc8e2b430 100644 --- a/pkg/commands/profile/list.go +++ b/pkg/commands/profile/list.go @@ -1,7 +1,7 @@ package profile import ( - "fmt" + "errors" "io" "github.com/fastly/cli/pkg/argparser" @@ -41,7 +41,7 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { if c.Globals.Config.Profiles == nil { msg := "no profiles available" return fsterr.RemediationError{ - Inner: fmt.Errorf(msg), + Inner: errors.New(msg), Remediation: fsterr.ProfileRemediation, } } diff --git a/pkg/commands/profile/token.go b/pkg/commands/profile/token.go index 1cb56b97e..073ae9333 100644 --- a/pkg/commands/profile/token.go +++ b/pkg/commands/profile/token.go @@ -1,6 +1,7 @@ package profile import ( + "errors" "fmt" "io" "time" @@ -57,7 +58,7 @@ func (c *TokenCommand) Exec(_ io.Reader, out io.Writer) (err error) { } msg := fmt.Sprintf(profile.DoesNotExist, name) return fsterr.RemediationError{ - Inner: fmt.Errorf(msg), + Inner: errors.New(msg), Remediation: fsterr.ProfileRemediation, } } @@ -71,7 +72,7 @@ func (c *TokenCommand) Exec(_ io.Reader, out io.Writer) (err error) { return nil } return fsterr.RemediationError{ - Inner: fmt.Errorf("no profiles available"), + Inner: errors.New("no profiles available"), Remediation: fsterr.ProfileRemediation, } } @@ -95,7 +96,7 @@ func checkTokenValidity(profileName string, p *config.Profile, ttl time.Duration } return fsterr.RemediationError{ - Inner: fmt.Errorf(msg), + Inner: errors.New(msg), Remediation: fsterr.TokenExpirationRemediation, } } diff --git a/pkg/commands/profile/update.go b/pkg/commands/profile/update.go index e3e09d5dc..30427623f 100644 --- a/pkg/commands/profile/update.go +++ b/pkg/commands/profile/update.go @@ -104,7 +104,7 @@ func (c *UpdateCommand) identifyProfile() (string, *config.Profile, error) { if p == nil { msg := fmt.Sprintf(profile.DoesNotExist, c.profile) return "", nil, fsterr.RemediationError{ - Inner: fmt.Errorf(msg), + Inner: errors.New(msg), Remediation: fsterr.ProfileRemediation, } } @@ -265,7 +265,7 @@ func (c *UpdateCommand) staticTokenFlow(profileName string, p *config.Profile, i if !ok { msg := fmt.Sprintf(profile.DoesNotExist, profileName) return fsterr.RemediationError{ - Inner: fmt.Errorf(msg), + Inner: errors.New(msg), Remediation: fsterr.ProfileRemediation, } } diff --git a/pkg/errors/deduce.go b/pkg/errors/deduce.go index 5d7095f2b..6eed7fd82 100644 --- a/pkg/errors/deduce.go +++ b/pkg/errors/deduce.go @@ -57,7 +57,7 @@ func SimplifyFastlyError(httpError fastly.HTTPError) error { if detail := httpError.Errors[0].Detail; detail != "" { s += fmt.Sprintf(" (%s)", detail) } - return fmt.Errorf(s) + return errors.New(s) default: return fmt.Errorf(