Skip to content

Commit

Permalink
Merge pull request #929 from saschagrunert/perfsprint
Browse files Browse the repository at this point in the history
Enable and fix `perfsprint` linter
k8s-ci-robot authored Apr 29, 2024
2 parents b7ba423 + 51559fa commit 0d28850
Showing 5 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ linters:
- nilnil
- nonamedreturns
- nosprintfhostport
- perfsprint
- prealloc
- predeclared
- promlinter
4 changes: 1 addition & 3 deletions commands/commands.go
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 2 additions & 1 deletion commands/export.go
Original file line number Diff line number Diff line change
@@ -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 {
3 changes: 2 additions & 1 deletion commands/set_version.go
Original file line number Diff line number Diff line change
@@ -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: <dependency> <version>")
return errors.New("expected exactly two arguments: <dependency> <version>")
}

client, err := dependency.NewLocalClient()
3 changes: 2 additions & 1 deletion pkg/gitlab/gitlab.go
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0d28850

Please sign in to comment.