Skip to content

Commit 2e5aa81

Browse files
fix: resolve lint issues (goconst, govet shadow, noctx, wsl)
- Use strconv.FormatBool in boolString to avoid goconst "true" literal - Rename shadowed err to writeErr in attachment test - Use http.NewRequestWithContext in transport test - Add blank lines before if statements per wsl_v5 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5919ccf commit 2e5aa81

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

internal/cmd/execute_gmail_attachment_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ func TestExecute_GmailAttachment_StaleFileIsRedownloaded(t *testing.T) {
408408
newGmailService = func(context.Context, string) (*gmail.Service, error) { return svc, nil }
409409

410410
outPath := filepath.Join(t.TempDir(), "invoice.pdf")
411-
if err := os.WriteFile(outPath, []byte("stale"), 0o600); err != nil {
411+
if writeErr := os.WriteFile(outPath, []byte("stale"), 0o600); writeErr != nil {
412412
t.Fatalf("WriteFile: %v", err)
413413
}
414414

internal/cmd/root.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"log/slog"
88
"os"
9+
"strconv"
910

1011
"github.com/alecthomas/kong"
1112

@@ -162,10 +163,7 @@ func envOr(key, fallback string) string {
162163
}
163164

164165
func boolString(v bool) string {
165-
if v {
166-
return "true"
167-
}
168-
return "false"
166+
return strconv.FormatBool(v)
169167
}
170168

171169
func newParser(description string) (*kong.Kong, *CLI, error) {

internal/googleapi/client_more_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,24 +268,29 @@ func TestNewBaseTransport_RespectsProxyAndTLSMinimum(t *testing.T) {
268268
if transport == nil {
269269
t.Fatalf("expected transport")
270270
}
271+
271272
if transport.Proxy == nil {
272273
t.Fatalf("expected proxy func")
273274
}
275+
274276
if transport.TLSClientConfig == nil {
275277
t.Fatalf("expected TLS config")
276278
}
279+
277280
if transport.TLSClientConfig.MinVersion < tls.VersionTLS12 {
278281
t.Fatalf("expected TLS min version >= 1.2, got %d", transport.TLSClientConfig.MinVersion)
279282
}
280283

281-
req, err := http.NewRequest(http.MethodGet, "https://www.googleapis.com", nil)
284+
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "https://www.googleapis.com", nil)
282285
if err != nil {
283286
t.Fatalf("new request: %v", err)
284287
}
288+
285289
proxyURL, err := transport.Proxy(req)
286290
if err != nil {
287291
t.Fatalf("proxy lookup: %v", err)
288292
}
293+
289294
if proxyURL == nil || !strings.Contains(proxyURL.String(), "127.0.0.1:8888") {
290295
t.Fatalf("expected HTTPS proxy to be honored, got: %v", proxyURL)
291296
}

0 commit comments

Comments
 (0)