From e70b54f2380457710c5e18fbb168d8b944bd8298 Mon Sep 17 00:00:00 2001 From: claw Date: Wed, 13 May 2026 07:13:12 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20address=20review=20feedback=20=E2=80=94?= =?UTF-8?q?=20gofmt=20NITs=20and=20remove=20unreachable=20default?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - github/client.go: add missing blank line between doRequestWithBody and doJSONRequest - cmd/review-bot/main.go: remove double blank line before findAllOwnReviews - cmd/review-bot/main.go: remove unreachable default case in VCS client init switch (provider is already validated at startup) - cmd/review-bot/main_test.go: remove double blank line before TestHasSharedToken - cmd/review-bot/main_test.go: fix comment alignment (gofmt) - review/persona_test.go: fix comment alignment in table literal (gofmt) --- cmd/review-bot/main.go | 4 ---- cmd/review-bot/main_test.go | 5 ++--- github/client.go | 1 + review/persona_test.go | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cmd/review-bot/main.go b/cmd/review-bot/main.go index 85927cf..e967981 100644 --- a/cmd/review-bot/main.go +++ b/cmd/review-bot/main.go @@ -179,9 +179,6 @@ func main() { ghBaseURL = "https://api.github.com" } client = github.NewClient(*reviewerToken, ghBaseURL) - default: - fmt.Fprintf(os.Stderr, "Error: unhandled provider %q\n", *provider) - os.Exit(1) } slog.Info("VCS client initialized", "provider", *provider) @@ -899,7 +896,6 @@ func extractSentinelName(body string) string { return name } - // findAllOwnReviews returns all non-superseded reviews matching the sentinel. func findAllOwnReviews(reviews []vcs.Review, sentinel string) []vcs.Review { var result []vcs.Review diff --git a/cmd/review-bot/main_test.go b/cmd/review-bot/main_test.go index b97c58e..f492b16 100644 --- a/cmd/review-bot/main_test.go +++ b/cmd/review-bot/main_test.go @@ -210,7 +210,6 @@ func TestBuildSupersededBodyShortSHA(t *testing.T) { } } - func TestHasSharedToken(t *testing.T) { tests := []struct { name string @@ -646,8 +645,8 @@ func TestExtractSentinelName_EdgeCases(t *testing.T) { {" rest", "sonnet"}, {" rest", "gpt-review"}, {"no sentinel here", "unknown"}, - {" end", "abc"}, // embedded in text + {" end", "abc"}, // embedded in text } for _, tc := range tests { diff --git a/github/client.go b/github/client.go index 8d41ee7..5ee9d85 100644 --- a/github/client.go +++ b/github/client.go @@ -386,6 +386,7 @@ func (c *Client) doRequestWithBody(ctx context.Context, method, reqURL string, r return c.doRequestCore(ctx, method, reqURL, opts) } + // doJSONRequest performs an HTTP request with a JSON body and returns the response body. // It delegates retry/backoff/429 handling to doRequestWithBody. // This is a general-purpose helper used by any method that needs to send JSON payloads diff --git a/review/persona_test.go b/review/persona_test.go index b90eae7..19a6814 100644 --- a/review/persona_test.go +++ b/review/persona_test.go @@ -355,7 +355,7 @@ func TestCapitalizeFirst(t *testing.T) { {"HELLO", "HELLO"}, {"a", "A"}, {"", ""}, - {"日本語", "日本語"}, // Non-ASCII: Japanese doesn't have case + {"日本語", "日本語"}, // Non-ASCII: Japanese doesn't have case {"über", "Über"}, // German umlaut {"élève", "Élève"}, // French accent }