agentws: fix golangci-lint findings
This commit is contained in:
+11
-11
@@ -146,7 +146,7 @@ func newNewCmd() *cobra.Command {
|
||||
if !os.IsNotExist(statErr) {
|
||||
return statErr
|
||||
}
|
||||
fmt.Fprintf(cmd.OutOrStdout(), "cloning %s into %s\n", cloneURL(repo), srcDir)
|
||||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "cloning %s into %s\n", cloneURL(repo), srcDir)
|
||||
if err := agent.GitClone(cloneURL(repo), srcDir, auth...); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -196,8 +196,8 @@ func newNewCmd() *cobra.Command {
|
||||
}
|
||||
|
||||
// f. Report the worktree path and branch.
|
||||
fmt.Fprintf(cmd.OutOrStdout(), "%s\n", wtPath)
|
||||
fmt.Fprintf(cmd.OutOrStdout(), "branch %s (from origin/%s)\n", branch, base)
|
||||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "%s\n", wtPath)
|
||||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "branch %s (from origin/%s)\n", branch, base)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
@@ -222,11 +222,11 @@ func newListCmd() *cobra.Command {
|
||||
}
|
||||
out := cmd.OutOrStdout()
|
||||
if len(managed) == 0 {
|
||||
fmt.Fprintln(out, "no managed worktrees")
|
||||
_, _ = fmt.Fprintln(out, "no managed worktrees")
|
||||
return nil
|
||||
}
|
||||
for _, w := range managed {
|
||||
fmt.Fprintf(out, "%s\t%s\t%s\n", w.repo, w.branch, w.path)
|
||||
_, _ = fmt.Fprintf(out, "%s\t%s\t%s\n", w.repo, w.branch, w.path)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
@@ -320,12 +320,12 @@ func removeWorktree(out io.Writer, wt managedWt, deleteBranch bool) error {
|
||||
if err := agent.GitWorktreeRemove(wt.srcDir, wt.path, true); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(out, "removed worktree %s\n", wt.path)
|
||||
_, _ = fmt.Fprintf(out, "removed worktree %s\n", wt.path)
|
||||
if deleteBranch {
|
||||
if err := agent.GitDeleteBranch(wt.srcDir, wt.branch, true); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(out, "deleted branch %s\n", wt.branch)
|
||||
_, _ = fmt.Fprintf(out, "deleted branch %s\n", wt.branch)
|
||||
}
|
||||
// Refresh the source repo's default branch, then prune.
|
||||
if err := agent.GitFetch(wt.srcDir, "origin", credentialHelperArgs()...); err != nil {
|
||||
@@ -348,7 +348,7 @@ func newCleanCmd() *cobra.Command {
|
||||
}
|
||||
out := cmd.OutOrStdout()
|
||||
if len(managed) == 0 {
|
||||
fmt.Fprintln(out, "no managed worktrees")
|
||||
_, _ = fmt.Fprintln(out, "no managed worktrees")
|
||||
return nil
|
||||
}
|
||||
for _, w := range managed {
|
||||
@@ -373,7 +373,7 @@ func newTokenCmd() *cobra.Command {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintln(cmd.OutOrStdout(), tok)
|
||||
_, _ = fmt.Fprintln(cmd.OutOrStdout(), tok)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
@@ -430,8 +430,8 @@ func credentialGet(stdin io.Reader, stdout io.Writer) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(stdout, "username=%s\n", agent.AgentLogin())
|
||||
fmt.Fprintf(stdout, "password=%s\n", tok)
|
||||
_, _ = fmt.Fprintf(stdout, "username=%s\n", agent.AgentLogin())
|
||||
_, _ = fmt.Fprintf(stdout, "password=%s\n", tok)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user