golangci: enable modernize linter#22197
Merged
Merged
Conversation
Enable the gopls modernize suite; disable the analyzers with an existing backlog (enable each once its findings are cleared). Clear the stringsseq backlog: convert the remaining strings.Split range loops to strings.SplitSeq, including the leak-tagged site the linter cannot see.
AskAlexSharov
approved these changes
Jul 3, 2026
17 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Enables golangci-lint’s modernize analyzer suite to mechanically enforce select Go “modernization” patterns going forward (notably strings.Split-in-loop → strings.SplitSeq), reducing recurring manual churn across the codebase.
Changes:
- Enabled the
modernizelinter in.golangci.ymland configured it to disable analyzers with existing backlog findings. - Rewrote the remaining
strings.Split(... )-in-range loops to usestrings.SplitSeq(... )in several packages (including one//go:build leaktest). - Kept behavior equivalent by preserving trimming/empty-token handling and loop control flow.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
.golangci.yml |
Enables modernize and disables backlog analyzers so CI remains manageable while enforcing newly-clean checks. |
execution/engineapi/engineapitester/engine_x_leak_test.go |
Switches /proc parsing loop to strings.SplitSeq in the leak-tagged test. |
db/state/commitment_convert.go |
Uses strings.SplitSeq when reading restore manifest lines to avoid allocating a full slice. |
cmd/evm/enginexrunner.go |
Uses strings.SplitSeq for path component scanning in isUnderPreAlloc. |
cl/sentinel/httpreqresp/server.go |
Uses strings.SplitSeq for comma-separated protocol topic parsing. |
cl/beacon/beaconhttp/api.go |
Uses strings.SplitSeq when iterating Accept header media types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
SonarCloud stopped treating git-submodule contents as SCM-ignored (server-side change on 2026-07-03), so the vendored ethereum/tests fixtures (~38.5k files) entered PR analyses as new code and their Dockerfile/JS findings fail the quality gate's security rating on every PR.
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.
Enables the
modernizelinter — the gopls modernize analyzer suite shipped with the pinned golangci-lint (v2.12.2) — so these modernizations are enforced mechanically instead of by periodic manual cleanup passes.mainare disabled viasettings.modernize.disable, keeping this PR config-only. Each gets enabled in its own PR once its backlog is cleared — tracked in lint: enable the remaining modernize analyzers #22199, which carries the per-analyzer finding counts, the workflow, and the autofix caveats.stringsseq,embedlit,errorsastype,newexpr,plusbuild,unsafefuncs.stringsseqsite sits behind//go:build leak(execution/engineapi/engineapitester/engine_x_leak_test.go), invisible to the linter, and is converted manually (typechecked withgo vet -tags leak).TDD note: mechanical change (lint config plus a behavior-preserving loop rewrite); no new tests — existing tests and the linter itself are the safety net.