Skip to content

Commit bf61d9b

Browse files
appleboyclaude
andcommitted
fix(lint): address PR review feedback
- Wrap original error with %w in anthropic APIError branches - Add trailing newline to color.White version output - Quote file path in test shell command with fmt.Sprintf %q Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a9852f2 commit bf61d9b

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

cmd/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func printVersion(format string, v VersionInfo) error {
8989
// Print each row with colored label and default value color
9090
for _, row := range rows {
9191
blue.Print(row[0])
92-
color.White(" %s", row[1])
92+
color.White(" %s\n", row[1])
9393
}
9494
return nil
9595
}

provider/anthropic/anthropic.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ func (c *Client) Completion(ctx context.Context, content string) (*core.Response
4242
if err != nil {
4343
var e *anthropic.APIError
4444
if errors.As(err, &e) {
45-
return nil, fmt.Errorf("messages error, type: %s, message: %s", e.Type, e.Message)
45+
return nil, fmt.Errorf(
46+
"messages error, type: %s, message: %s: %w",
47+
e.Type,
48+
e.Message,
49+
err,
50+
)
4651
}
4752
return nil, fmt.Errorf("messages error: %w", err)
4853
}
@@ -95,7 +100,12 @@ func (c *Client) CompletionStream(
95100
if err != nil {
96101
var e *anthropic.APIError
97102
if errors.As(err, &e) {
98-
return nil, fmt.Errorf("messages error, type: %s, message: %s", e.Type, e.Message)
103+
return nil, fmt.Errorf(
104+
"messages error, type: %s, message: %s: %w",
105+
e.Type,
106+
e.Message,
107+
err,
108+
)
99109
}
100110
return nil, fmt.Errorf("messages error: %w", err)
101111
}

util/api_key_helper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ func TestGetAPIKeyFromHelperWithCache_CacheExpiration(t *testing.T) {
271271

272272
// Create a counter file that we'll update manually
273273
counterFile := filepath.Join(tmpDir, "counter2.txt")
274-
command := "cat " + counterFile
274+
command := fmt.Sprintf("cat %q", counterFile)
275275

276276
// Write initial value
277277
if err := os.WriteFile(counterFile, []byte("value1"), 0o600); err != nil {

0 commit comments

Comments
 (0)