Skip to content

chore: Go 1.26 modernization pass#9

Merged
dotwaffle merged 1 commit intomainfrom
chore/go-1.26-modernization
Apr 11, 2026
Merged

chore: Go 1.26 modernization pass#9
dotwaffle merged 1 commit intomainfrom
chore/go-1.26-modernization

Conversation

@dotwaffle
Copy link
Copy Markdown
Owner

Summary

  • errors.As(err, &target)errors.AsType[*T](err) (Go 1.26) in 4 call sites: sync/worker.go rateLimited(), peeringdb/stream_test.go, peeringdb-plus/server_test.go, middleware/maxbody_test.go
  • if x == "" { x = default }cmp.Or(x, default) (Go 1.22 catch-up) in 6 call sites across web/handler.go, httperr/problem.go, web/termrender/whois.go (×3), sync/worker.go StartScheduler

go fix reports zero actionable diffs outside generated code — ent/rest/* has omitempty→omitzero suggestions that go fix correctly defers as "alternative fix (behavior change)". Those are skipped because ent/rest/ is regenerated on every go generate anyway.

Intentionally skipped:

  • pdbcompat-check/main.go goldenDir fallback — the default calls findGoldenDir() which walks the filesystem, so eager evaluation via cmp.Or would regress.
  • proto.Int64() in test files — changing to new(int64(N)) is noise without benefit.

Test plan

  • go build ./...
  • go vet ./...
  • golangci-lint run ./... (0 issues)
  • go test -race ./... (all green)

🤖 Generated with Claude Code

errors.As(err, &target) → errors.AsType[*T](err) (Go 1.26):
  internal/sync/worker.go         rateLimited() helper
  internal/peeringdb/stream_test  *json.SyntaxError assertion
  cmd/peeringdb-plus/server_test  *net.OpError probe
  internal/middleware/maxbody_test *http.MaxBytesError guard

if x == "" { x = default } → cmp.Or(x, default) (Go 1.22 catch-up):
  internal/web/handler.go         viewMode default
  internal/httperr/problem.go     problem title default (StatusText)
  internal/web/termrender/whois.go three descr fallback blocks
  internal/sync/worker.go         StartScheduler mode default

go fix reports zero actionable diffs outside generated code
(ent/rest/* has omitempty→omitzero alternative fixes deferred as
behavior changes, correctly ignored).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Code Metrics Report

Coverage
83.8%

Code coverage of files in pull request scope (88.4%)

Files Coverage
internal/httperr/problem.go 100.0%
internal/sync/worker.go 85.0%
internal/web/handler.go 85.4%
internal/web/termrender/whois.go 98.7%

Reported by octocov

@dotwaffle dotwaffle merged commit 39ffb9f into main Apr 11, 2026
5 checks passed
@dotwaffle dotwaffle deleted the chore/go-1.26-modernization branch April 11, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant