From 7ef7c3b10752bee9554b47861bb17b6a4be55783 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Feb 2026 16:24:05 +0000 Subject: [PATCH] chore: use %w for error wrapping Co-Authored-By: Claude Opus 4.6 --- cmd/forge/cmd_sync.go | 4 ++-- cmd/gitea/cmd_sync.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/forge/cmd_sync.go b/cmd/forge/cmd_sync.go index 9f73414..578dd7e 100644 --- a/cmd/forge/cmd_sync.go +++ b/cmd/forge/cmd_sync.go @@ -306,7 +306,7 @@ func syncPushUpstream(localPath, defaultBranch string) error { cmd := exec.Command("git", "-C", localPath, "push", "--force", "forge", refspec) output, err := cmd.CombinedOutput() if err != nil { - return fmt.Errorf("%s", strings.TrimSpace(string(output))) + return fmt.Errorf("%s: %w", strings.TrimSpace(string(output)), err) } return nil @@ -316,7 +316,7 @@ func syncGitFetch(localPath, remote string) error { cmd := exec.Command("git", "-C", localPath, "fetch", remote) output, err := cmd.CombinedOutput() if err != nil { - return fmt.Errorf("%s", strings.TrimSpace(string(output))) + return fmt.Errorf("%s: %w", strings.TrimSpace(string(output)), err) } return nil } diff --git a/cmd/gitea/cmd_sync.go b/cmd/gitea/cmd_sync.go index 8149b8a..f6a7c02 100644 --- a/cmd/gitea/cmd_sync.go +++ b/cmd/gitea/cmd_sync.go @@ -321,7 +321,7 @@ func pushUpstream(localPath, defaultBranch string) error { cmd := exec.Command("git", "-C", localPath, "push", "--force", "gitea", refspec) output, err := cmd.CombinedOutput() if err != nil { - return fmt.Errorf("%s", strings.TrimSpace(string(output))) + return fmt.Errorf("%s: %w", strings.TrimSpace(string(output)), err) } return nil @@ -332,7 +332,7 @@ func gitFetch(localPath, remote string) error { cmd := exec.Command("git", "-C", localPath, "fetch", remote) output, err := cmd.CombinedOutput() if err != nil { - return fmt.Errorf("%s", strings.TrimSpace(string(output))) + return fmt.Errorf("%s: %w", strings.TrimSpace(string(output)), err) } return nil }