6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-15 20:25:06 +00:00

Fix issues found by mirror linter

This commit is contained in:
Grzegorz Dlugoszewski
2025-08-24 18:01:42 +02:00
parent 0db5ba6f5a
commit 08f3264cd0
4 changed files with 4 additions and 2 deletions

View File

@@ -93,7 +93,7 @@ func readGitconfig(cfg Gitconfig) {
viper.SetConfigType("env") viper.SetConfigType("env")
if err := viper.ReadConfig(bytes.NewBuffer([]byte(strings.Join(lines, "\n")))); err != nil { if err := viper.ReadConfig(bytes.NewBufferString(strings.Join(lines, "\n"))); err != nil {
// Log error but don't fail - configuration is optional // Log error but don't fail - configuration is optional
fmt.Fprintf(os.Stderr, "Warning: failed to read git config: %v\n", err) fmt.Fprintf(os.Stderr, "Warning: failed to read git config: %v\n", err)
} }

View File

@@ -413,6 +413,7 @@ func TestRemote(t *testing.T) {
func createTestDirTree(t *testing.T) string { func createTestDirTree(t *testing.T) string {
t.Helper() t.Helper()
root := test.TempDir(t, "") root := test.TempDir(t, "")
err := os.MkdirAll(filepath.Join(root, "a", "b", "c"), os.ModePerm) err := os.MkdirAll(filepath.Join(root, "a", "b", "c"), os.ModePerm)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

View File

@@ -39,7 +39,7 @@ func (r *Repo) writeFile(filename string, content string) {
file, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) file, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
checkFatal(r.t, err) checkFatal(r.t, err)
_, err = file.Write([]byte(content)) _, err = file.WriteString(content)
checkFatal(r.t, err) checkFatal(r.t, err)
} }

View File

@@ -34,6 +34,7 @@ type Cmd struct {
// Git creates a git command with given arguments. // Git creates a git command with given arguments.
func Git(args ...string) *Cmd { func Git(args ...string) *Cmd {
ctx := context.Background() ctx := context.Background()
return &Cmd{ return &Cmd{
cmd: exec.CommandContext(ctx, "git", args...), cmd: exec.CommandContext(ctx, "git", args...),
args: strings.Join(args, " "), args: strings.Join(args, " "),