6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-04 12:46:46 +00:00

Fix issues found by perfsprint linter

This commit is contained in:
Grzegorz Dlugoszewski
2025-08-24 18:21:17 +02:00
parent aa1da8e3da
commit 1bf52c4c32
4 changed files with 5 additions and 5 deletions

View File

@@ -62,7 +62,7 @@ func Version() string {
return fmt.Sprintf("git-get %s (%s)", version, commit[:7]) 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. // Gitconfig represents gitconfig file.

View File

@@ -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. // Upstream returns the name of an upstream branch if a given branch is tracking one.
// Otherwise it returns an empty string. // Otherwise it returns an empty string.
func (r *Repo) Upstream(branch string) (string, error) { 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 { if err != nil {
// TODO: no upstream will also throw an error. // TODO: no upstream will also throw an error.
// lint:ignore nilerr fix when working on TODO // lint:ignore nilerr fix when working on TODO

View File

@@ -1,11 +1,11 @@
package git package git
import ( import (
"fmt"
"git-get/pkg/git/test" "git-get/pkg/git/test"
"os" "os"
"path/filepath" "path/filepath"
"reflect" "reflect"
"strconv"
"testing" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
@@ -339,7 +339,7 @@ func TestCleanupFailedClone(t *testing.T) {
} }
for i, test := range tests { 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) root := createTestDirTree(t)
path := filepath.Join(root, test.path) path := filepath.Join(root, test.path)

View File

@@ -20,7 +20,7 @@ func NewTreePrinter() *TreePrinter {
// Print generates a tree view of repos and their statuses. // Print generates a tree view of repos and their statuses.
func (p *TreePrinter) Print(root string, repos []Printable) string { func (p *TreePrinter) Print(root string, repos []Printable) string {
if len(repos) == 0 { 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) tree := buildTree(root, repos)