Repository navigation
Require Go 1.26 and lint with golangci-lint v2 - #169
Merged
Merged
Conversation
Since Go 1.19, gofmt normalizes doc comments: code blocks use a single tab and list items use " - ". Apply that formatting so that newer gofmt versions leave the files unchanged. Refs #166 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d5946d63-5054-4db7-8484-2db48414dc6e
Newer staticcheck releases report these patterns: * ST1006: omit unused `_` receiver names * ST1023: drop the redundant type in `nameStyle`'s declaration * QF1001: apply De Morgan's law to the JSON version checks * QF1002: use a tagged switch on the file mode No behavior change. Refs #166 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d5946d63-5054-4db7-8484-2db48414dc6e
There was a problem hiding this comment.
🔵 Needs a closer look
The migration affects the Go baseline and repository-wide golangci-lint v2 configuration, but its CI, formatter, and exclusion behavior requires external execution that is unavailable in this review snapshot.
No open issues 🎉
What changed in this PR
This PR raises the minimum Go version to 1.26 and updates the linting toolchain to golangci-lint v2.15.0 with Go 1.27.4, applying the corresponding code, formatting, dependency, and configuration changes.
Changes:
- Updates the module and CI toolchains for supported Go and golangci-lint releases.
- Migrates the golangci-lint configuration to v2 syntax.
- Applies Go modernization and formatting updates, including
slices.Concatusage.
| File | Description |
|---|---|
| sizes/path_resolver.go | Removes unused method receiver names. |
| sizes/output.go | Updates documentation formatting and removes an obsolete lint suppression. |
| sizes/graph.go | Simplifies file-mode dispatch logic. |
| internal/testutils/repoutils.go | Uses slices.Concat to construct Git command arguments. |
| internal/refopts/filter_value.go | Updates documentation list formatting. |
| go.sum | Removes obsolete module checksum entries. |
| go.mod | Raises the required Go version to 1.26. |
| git/reference.go | Updates documentation formatting. |
| git/ref_filter.go | Removes unused method receiver names. |
| git/gitconfig.go | Updates documentation example formatting. |
| git/git.go | Uses slices.Concat to construct Git command arguments. |
| git-sizer.go | Simplifies declarations and boolean validation expressions. |
| .golangci.toml | Migrates the lint configuration to the golangci-lint v2 schema. |
| .github/workflows/lint.yml | Updates the lint workflow to Go 1.27.4 and golangci-lint 2.15.0. |
Review effort: Lite (adaptive)
go.mod still declared `go 1.17`, a release that has been unsupported for years. Raise it to `go 1.26`, the oldest supported release. Don't go higher: gitrpcd builds the vendored git-sizer with Go 1.26. golangci-lint 1.43.0 can't lint code that requires a newer Go release, so move lint.yml to golangci-lint 2.15.0 and Go 1.27.4 and port .golangci.toml to the v2 format. v2 dropped errcheck's default `ignore = "fmt:.*"`, so exclude the `fmt.Fprint*` functions explicitly. Exclude the new noctx check for exec.Command. Fix the new findings: newer gosec flags `os.Create` with a variable path (G304), and prealloc flags `append` to a literal. Use `slices.Concat` for the latter, which needs Go 1.22 and therefore can't land before the go.mod change. Refs #166 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d5946d63-5054-4db7-8484-2db48414dc6e
larsxschneider
force-pushed
the
ls/golangci-lint-v2
branch
from
November 27, 2026 12:06
9175c20 to
5d68b1e
Compare
jayhthanki
approved these changes
Nov 27, 2026
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.
Raise the
godirective ingo.modfrom1.17to1.26and movelint.ymlfromgolangci-lint1.43.0(Go1.17) togolangci-lint2.15.0(Go1.27.4). Follow-up to #167.Why
go 1.17has been unsupported for years (Unsupported language version #166).go 1.26is the oldest supported release.golangci-lint1.43.0can't lint code that requires a newer Go release, so the linter upgrade has to come with thego.modchange.Changes
The
.golangci.tomlwas ported to the v2 format via Copilot. Is uses the same linters and settings, except:deadcode,structcheck,varcheck,exportlooprefandtypecheckno longer exist in v2.unusedcovers the first three;exportlooprefis obsolete since Go 1.22 loop variable semantics.errcheck: v2 dropped the v1 defaultignore = "fmt:.*", sofmt.Fprint,fmt.Fprintfandfmt.Fprintlnare now listed inexclude-functions.noctx: the newexec.Commandcheck is excluded. Passing a context to all git commands is a separate change.staticchecknow includes the formerstylecheck(ST*) and quickfix (QF*) checks, which v1 did not run. They stay enabled. Their findings are fixed in the second commit.Refs #166