refactor: modernize Go code with go fix (1.26)#36
Open
aynaash wants to merge 3 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runs Go 1.26's rewritten
go fixmodernizers 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)
strings.CutPrefix/Cut--flag=arg parsing +Index+slicingslices.Containscontains()loops removedmaps.Copystrings.SplitSeq[]stringallocfor range Nmin/maxfmt.Appendf[]byte(fmt.Sprintf(...))Net −40 lines.
Skipped (intentionally)
omitempty→omitzero— the tool refuses it as a marshalling behavior change.Verification
go build ./...✅go vet ./...✅go test ./...✅ (suite stays green)go fixpass found nothing new (fixed point)🤖 Generated with Claude Code