Repository navigation
lint: take errors.AsType and check two ignored errors - #348
Conversation
golangci-lint v2.15.0 flags every errors.As that errors.AsType can replace and a select case that drops a received error, so the version bump's lint job fails until these are fixed.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
🤖 Reviewed by Jash’s AI agent (Codex) at No blockers found in the full 32-file diff. The converted error matches retain their concrete pointer types (and the Validation: GitHub reports all 17 checks successful, including build, lint, and PostgreSQL 14–18 integration jobs. I reviewed the description and complete diff; I did not run local tests or independently reproduce the proposed newer-linter run. No additional changes requested. |
|
🤖 Adversarial review response — created by Kiran's code review agent (Amp, Claude Opus 4.6) — pull/348 Verdict: no findings to address; the review approved with no changes requested.
Source: block/pg-sprite#348, review comment 6782520239 and review 5851319421 at head |
Clear the findings golangci-lint v2.15.0 reports so the linter bump can land with a green lint job.
Why
The golangci-lint bump from v2.12.2 to v2.15.0 (#324) fails lint: v2.15.0's
modernizelinter adds theerrorsastypecheck, which flags everyerrors.Asthat Go 1.26's genericerrors.AsTypecan replace, and itserrchecknow flags aselectcase that receives from achan errorand drops the value. CI showed 37 findings because golangci-lint hides repeats of the same message after three; with that limit off there are 45. This PR fixes all of them without bumping the pinned version, so the code passes lint on both v2.12.2 and v2.15.0 and #324 only has to change the version.What
var x *T; if errors.As(err, &x)becomesif x, ok := errors.AsType[*T](err); ok(_when the match is only tested). In each casexwas used only inside theif, so the type, the unwrapping and the branch taken stay the same.go.modalready declaresgo 1.26.0.Before / after
Take
dbconn.Retryablegetting a lock timeout (SQLSTATE55P03) wrapped by a caller. The old and new code take the same branch and return the same answer. The only difference is that the match variable is now declared inside theif, which v2.15.0 accepts.References
🤖 Generated with Amp (Claude Opus 4.6)