Skip to content

refactor: modernize Go code with go fix (1.26)#36

Open
aynaash wants to merge 3 commits into
mainfrom
chore/go-fix-modernize
Open

refactor: modernize Go code with go fix (1.26)#36
aynaash wants to merge 3 commits into
mainfrom
chore/go-fix-modernize

Conversation

@aynaash

@aynaash aynaash commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Runs Go 1.26's rewritten go fix modernizers across the repo. Split into two commits so the boring rename is easy to skim and the structural changes are easy to read.

Commit 1 — interface{}any (32 files)

Pure rename, zero behavior change.

Commit 2 — structural modernizers (50 files)

Modernizer ~Hits What
strings.CutPrefix / Cut ~22 Manual --flag= arg parsing + Index+slicing
slices.Contains ~17 Hand-rolled contains() loops removed
maps.Copy 8 Manual map-copy loops
strings.SplitSeq ~8 Iterator form, avoids []string alloc
for range N 3 3-clause loops with unused index
min / max 2 Clamp logic in image optimizer
fmt.Appendf 2 Over []byte(fmt.Sprintf(...))

Net −40 lines.

Skipped (intentionally)

omitemptyomitzero — the tool refuses it as a marshalling behavior change.

Verification

  • go build ./...
  • go vet ./...
  • go test ./... ✅ (suite stays green)
  • Second go fix pass found nothing new (fixed point)

🤖 Generated with Claude Code

aynaash and others added 3 commits June 21, 2026 04:16
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Apply go fix modernizers (Go 1.26): slices.Contains, maps.Copy,
strings.Cut/CutPrefix, strings.SplitSeq, range-over-int, min/max, fmt.Appendf.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The any modernizer's gofmt realignment and signature edits dragged
pre-existing lint debt (revive exported-comment, var-naming Id->ID,
gocognit complexity, gosec) into golangci-lint's only-new-issues set.

Revert the interface{}->any change on exactly those lines/files so they
leave the diff; keep all structural wins (slices/maps/strings/Appendf)
and the rest of the any conversion. Fix the one genuinely-new hit
(octal literal 0600 -> 0o600).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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