diff --git a/.golangci.yml b/.golangci.yml index 7e97bb0f..213bc431 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -54,6 +54,7 @@ linters: - nilnil - nonamedreturns - nosprintfhostport + - perfsprint - prealloc - predeclared - promlinter diff --git a/commands/commands.go b/commands/commands.go index 293dac92..ced9590f 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -17,8 +17,6 @@ limitations under the License. package commands import ( - "fmt" - "github.com/spf13/cobra" "sigs.k8s.io/release-utils/log" @@ -67,7 +65,7 @@ func New(opts Options) *cobra.Command { &rootOpts.logLevel, "log-level", "info", - fmt.Sprintf("the logging verbosity, either %s", log.LevelNames()), + "the logging verbosity, either "+log.LevelNames(), ) AddCommands(cmd) diff --git a/commands/export.go b/commands/export.go index a42fa07a..2b7286c1 100644 --- a/commands/export.go +++ b/commands/export.go @@ -18,6 +18,7 @@ package commands import ( "encoding/json" + "errors" "fmt" "os" @@ -57,7 +58,7 @@ func (exo *exportOptions) setAndValidate() error { case JSON: case LOG: default: - return fmt.Errorf("unsuported output format") + return errors.New("unsuported output format") } if exo.outputFile != "" && OutputFormat(exo.outputFormat) == LOG { diff --git a/commands/set_version.go b/commands/set_version.go index 0f760419..d83f23f8 100644 --- a/commands/set_version.go +++ b/commands/set_version.go @@ -17,6 +17,7 @@ limitations under the License. package commands import ( + "errors" "fmt" "github.com/spf13/cobra" @@ -46,7 +47,7 @@ func addSetVersion(topLevel *cobra.Command) { // upgrading/downgrading a single dependency to the specified version. func runSetVersion(opts *options, args []string) error { if len(args) != 2 { - return fmt.Errorf("expected exactly two arguments: ") + return errors.New("expected exactly two arguments: ") } client, err := dependency.NewLocalClient() diff --git a/pkg/gitlab/gitlab.go b/pkg/gitlab/gitlab.go index 704f1871..66bf46d5 100644 --- a/pkg/gitlab/gitlab.go +++ b/pkg/gitlab/gitlab.go @@ -17,6 +17,7 @@ limitations under the License. package gitlab import ( + "errors" "fmt" "github.com/sirupsen/logrus" @@ -179,7 +180,7 @@ func (g *GitLab) GetRepository(owner, repo string) (*gitlab.Project, error) { } if len(projects) == 0 { - return nil, fmt.Errorf("no project found") + return nil, errors.New("no project found") } return projects[0], nil