From 1bf52c4c32c30b910fa2b5968afb97dd489c0e4b Mon Sep 17 00:00:00 2001 From: Grzegorz Dlugoszewski Date: Sun, 24 Aug 2025 18:21:17 +0200 Subject: [PATCH] Fix issues found by perfsprint linter --- pkg/cfg/config.go | 2 +- pkg/git/repo.go | 2 +- pkg/git/repo_test.go | 4 ++-- pkg/out/tree.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/cfg/config.go b/pkg/cfg/config.go index f362fe6..c24aa6f 100644 --- a/pkg/cfg/config.go +++ b/pkg/cfg/config.go @@ -62,7 +62,7 @@ func Version() string { return fmt.Sprintf("git-get %s (%s)", version, commit[:7]) } - return fmt.Sprintf("git-get %s", version) + return "git-get " + version } // Gitconfig represents gitconfig file. diff --git a/pkg/git/repo.go b/pkg/git/repo.go index a4dee0a..201d31d 100644 --- a/pkg/git/repo.go +++ b/pkg/git/repo.go @@ -153,7 +153,7 @@ func (r *Repo) Branches() ([]string, error) { // Upstream returns the name of an upstream branch if a given branch is tracking one. // Otherwise it returns an empty string. func (r *Repo) Upstream(branch string) (string, error) { - out, err := run.Git("rev-parse", "--abbrev-ref", "--symbolic-full-name", fmt.Sprintf("%s@{upstream}", branch)).OnRepo(r.path).AndCaptureLine() + out, err := run.Git("rev-parse", "--abbrev-ref", "--symbolic-full-name", branch+"@{upstream}").OnRepo(r.path).AndCaptureLine() if err != nil { // TODO: no upstream will also throw an error. // lint:ignore nilerr fix when working on TODO diff --git a/pkg/git/repo_test.go b/pkg/git/repo_test.go index b67a974..9ee8510 100644 --- a/pkg/git/repo_test.go +++ b/pkg/git/repo_test.go @@ -1,11 +1,11 @@ package git import ( - "fmt" "git-get/pkg/git/test" "os" "path/filepath" "reflect" + "strconv" "testing" "github.com/stretchr/testify/assert" @@ -339,7 +339,7 @@ func TestCleanupFailedClone(t *testing.T) { } for i, test := range tests { - t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { + t.Run(strconv.Itoa(i), func(t *testing.T) { root := createTestDirTree(t) path := filepath.Join(root, test.path) diff --git a/pkg/out/tree.go b/pkg/out/tree.go index 48c8443..8bbe097 100644 --- a/pkg/out/tree.go +++ b/pkg/out/tree.go @@ -20,7 +20,7 @@ func NewTreePrinter() *TreePrinter { // Print generates a tree view of repos and their statuses. func (p *TreePrinter) Print(root string, repos []Printable) string { if len(repos) == 0 { - return fmt.Sprintf("There are no git repos under %s", root) + return "There are no git repos under " + root } tree := buildTree(root, repos)