Repository navigation
chore(deps): bump Go to 1.27.1 - #1438
Conversation
govulncheck fails identically on v1.7-dev and every open PR branch (#1412, #1411, #1410) with 6 Go standard-library findings, all "Found in: go1.26.5 / Fixed in: go1.26.6": - GO-2026-6218 (net/url) - GO-2026-6091 (html/template) - GO-2026-6090 (crypto/tls) - GO-2026-6089 (net/http, x2) - GO-2026-5972 (encoding/asn1) Reachable from our TLS/RPC/HTTP server and Dash Core client paths (same call sites as PR #1395). Bumping the pinned toolchain from 1.26.5 to 1.26.6 turns govulncheck green everywhere at once and unblocks #1412, #1411, #1410. Mirrors PR #1395's pattern (1.26.4 -> 1.26.5): pure patch-release toolchain swap, no language/API changes, same 16 files touched (go.mod, CI workflow go-version pins, Dockerfiles, docs). Verified locally with go1.26.6: go build ./... succeeds, and govulncheck ./... reports 0 vulnerabilities (down from 6). Claude-Session: https://claude.ai/code/session_01RoXmbFrVf1BqVW1BHZv6Va Co-authored-by: Claude Sonnet 5 <[email protected]> (cherry picked from commit 0a7a33e)
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
ℹ️ Review superseded (commit 8706479) |
golangci-lint v2.12.2 (the latest v2.12.x, matching the current floating `version: v2.12` selector) panics rather than reporting findings when analyzing this codebase under Go 1.27.1: the bundled staticcheck analyzer (honnef.co/go/[email protected]) crashes its SSA/IR builder with "unexpected expr: *ast.KeyValueExpr" while building IR for the stdlib package internal/poll. Confirmed deterministic (reproduced twice) and not a stale-binary artifact (rebuilt golangci-lint v2.12.2 from source with the go1.27.1 toolchain itself, same panic). Isolating the culprit with --disable=staticcheck makes the panic disappear and returns 0 issues, but disabling staticcheck in CI is rejected as a fix: it is the linter catching the QF1008 class, and turning it off to land a version bump would trade a real gate for a green tick. golangci-lint v2.13.0 shipped 2026-08-19, the same day as Go 1.27.0 — the 2.13 line is Go 1.27-compatible where 2.12 predates Go 1.27 entirely. Measured v2.13.2 (the latest v2.13.x) built fresh with both toolchains: no panic and 0 --new-from-rev findings at go1.26.6 and at go1.27.1. The two changes are independent, so this commit lands ahead of and does not depend on the Go 1.27.1 bump that follows it — every intermediate commit in this branch keeps the lint job runnable. Kept the existing floating-minor pin convention (`v2.13`, not an exact `v2.12.2`-style pin): the crash was caused by the minor version predating Go 1.27, not by floating within a minor, so an exact pin would have failed identically and there is no reason to change the convention in response to a problem it did not cause. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
The `check-mocks` CI job pins `mockery=3.7.0` (released 2026-03-06,
five months before Go 1.27.0). Under a go1.27.1 toolchain, mockery
3.7.0 fails outright rather than producing a diff:
internal error: package "github.com/dashpay/tenderdash/libs/ds"
without types was imported from "github.com/dashpay/tenderdash/libs/store"
This is mockery's bundled golang.org/x/tools/go/packages loader
failing to attach type information to a transitively-imported
package when driven by the newer toolchain — not a defect in this
repository's source. Reproduced locally under the exact conditions
CI runs (GOTOOLCHAIN=local, the go1.27.1 binary setup-go installs,
no auto-download); the CI log itself can't show this, since the
generation step runs `make mockery 2>/dev/null` and discards stderr
— anyone hitting this in CI needs to reproduce it locally to see
anything past "exit code 2".
mockery v3.7.4 (released 2026-08-23, four days after Go 1.27.0)
fixes it: same reproduction conditions, clean exit. Measured it under
both go1.26.6 and go1.27.1 and got byte-identical regenerated output
either way — the interface{}->any / parameter-naming differences
below come entirely from mockery's own codegen version, not from
which Go toolchain drives it. That's what makes this commit stand on
its own ahead of the Go 1.27.1 bump that follows it in this branch,
rather than being a consequence of it.
Bumped both pin sites: check-generated.yml's MOCKERY and
scripts/mockery_generate.sh's VERSION. The version bump and the
regenerated mocks can't be split into separate commits: CI
regenerates and diffs in the same step, so a pin bump without
regenerated mocks leaves check-mocks red (diff appears), and
regenerated mocks without the pin bump leaves it red too (CI
regenerates with 3.7.0 and hits the error above again).
Regenerated all mocks under mockery v3.7.4 (`make mockery`). The
diff is mechanical and cosmetic only, inspected file-by-file rather
than trusted from the diffstat: every change is either
`interface{}` -> `any` in generated _Expecter method signatures (Go
1.18+ built-in alias, identical type), or a generated parameter name
recovering the interface's real source name where 3.7.0 fell back to
a generic placeholder (`v`, `vs`, `context1`). No method set changed,
no mock behavior changed. Confirmed behaviorally rather than just by
reading the diff: `go build ./...` is clean with the regenerated
mocks in place, and `go test ./internal/consensus/... -count=1` is
green (one run hit the already-known-flaky TestByzantinePrevoteEquivocation
from this task's original brief; a second run was clean, consistent
with that test's known ~18% flake rate and unrelated to this change).
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
561ab02 to
c87700a
Compare
Go 1.27 changed HTTP/1 Response.Body.Close() to automatically drain
any unread content, up to a conservative limit, to allow the
underlying connection to be reused (see the "net/http" section of
the Go 1.27 release notes). TestMaxOpenConnections never reads its
response bodies before closing them, so under Go 1.27 the requests
it makes leave healthy, idle keep-alive connections sitting in the
client's pool instead of being closed outright as they were under
Go 1.26. Those idle connections keep the corresponding server-side
handler goroutines parked in a read wait, which the leaktest check
registered at the top of the test flags as leaked:
leaktest: leaked goroutine: ... [IO wait]:
... net/http.(*conn).serve ...
created by net/http.(*Server).Serve
This is not a defect in the server's shutdown path, and reading the
response body before closing it does not fix it — 1.27 already
drains it for you, which is the entire behavior change; an explicit
drain reaches the identical end state (healthy, pooled connection,
server goroutine still parked). Confirmed by testing it directly:
draining the body explicitly still leaks 100% of the time under
go1.27.1.
Fixed by sharing one Client across the request goroutines (http.Client
is safe for concurrent use) and calling its CloseIdleConnections after
they've all completed, before the leaktest check fires. This does not
change what the test measures: instrumented it locally to confirm
peak concurrent open connections still reaches exactly `max` with the
shared client, matching the per-goroutine-client version — concurrent
in-flight requests still each need their own connection regardless of
pooling, since pooling only affects connections after they go idle.
Verified at both go1.26.6 and go1.27.1 (5 consecutive runs each,
clean at both, plus one run with -race): this fix is a general test
correctness improvement, not conditional on either toolchain, which
is why it lands ahead of the Go 1.27.1 bump in this branch rather
than after it.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
TestRPCParams and TestParseURI/Decode asserted on the stdlib's exact
wording for a malformed json.Number ("invalid number literal" /
"invalid number"). That wording changed between Go versions — under
Go 1.27 it reads "cannot unmarshal string ... into Go value of type
json.Number: invalid syntax" instead — which breaks the assertion
even though the actual behavior (the malformed input is still
rejected, with the same RPC error code) hasn't changed at all.
Traced the code path rather than guessing a new substring:
RPCFunc.parseParams wraps every parameter-decode failure via
invalidParamsError(), which always builds an rpctypes.RPCError with
Code: CodeInvalidParams and Message: CodeInvalidParams.String() —
our own constant, literally "Invalid params", unconditionally. Only
RPCError.Data ever carries the wrapped stdlib error text. Asserting
on "Invalid params" instead of the stdlib phrase pins our own
contract (this rejection landed in the invalid-params family) rather
than a description we don't own and that a future Go release is free
to reword again.
This is also a stronger assertion than the one it replaces: the old
substring match could not distinguish an invalid-params rejection
from any other error that happened to contain the same words,
whereas the new one names the specific error family.
Checked for the same pattern elsewhere before touching only these
two sites: types/genesis_test.go:164 pins a different stdlib JSON
error string ("cannot unmarshal string into Go struct field ... of
type int64"), but that's the struct-field type-mismatch error class,
not the json.Number-literal class this Go release changed, and it
already passes clean under go1.27.1 (16/16 subtests) — confirmed by
running it, not assumed. Two sites, not a repo-wide problem.
Verified at both go1.26.6 and go1.27.1 (all TestRPCParams and
TestParseURI subtests green at both, full package test suite green
at go1.26.6): version-neutral, so this lands ahead of the Go 1.27.1
bump rather than after it.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
Follow-on to the previous two commits: with golangci-lint on v2.13 (previous commit), it is safe to move the pinned Go toolchain past 1.26.6 to 1.27.1. This is a minor-version bump, not a patch bump — Go 1.26.6 -> 1.27.1 crosses a Go release boundary, so the "no language/API changes" claim that held for the 1.26.5 -> 1.26.6 patch swap does not carry here and was verified fresh rather than assumed. Verified for the full three-commit stack (this commit on top of the golangci-lint v2.13 bump on top of the Go 1.26.6 cherry-pick): - go build ./... clean. - go vet ./... reports the same 4 findings, byte-for-byte, before and after this commit (3x fmt.Errorf %q in test/e2e/pkg/testnet.go, 1x IPv6 address format in dash/quorum/nodeid_resolver.go) — all pre-existing and unrelated to this change. No new vet strictness under Go 1.27. - govulncheck ./... reports the same finding sets before and after: 0 stdlib vulnerabilities affecting our code, and the same 4 dependency-only findings our code doesn't call (GO-2026-6355, GO-2026-6354, GO-2026-6303, GO-2026-5932) on both sides. - golangci-lint v2.13.2 (what the v2.13 selector resolves to) with --new-from-rev=origin/v1.7-dev: 0 issues, no panic. - go test ./internal/consensus/... -count=1, twice: both green (61.1s, 69.0s) on the final three-commit stack. - GOTOOLCHAIN=auto correctly resolves and downloads go1.27.1 from this module's go.mod, confirmed via `go version` run from inside the module. What moved, reported rather than fixed: - golangci-lint's gofmt formatter (.golangci.yml formatters.enable) flags one pre-existing, untouched file — internal/rpc/core/ mempool.go:149 — as differently formatted under Go 1.27.1's bundled gofmt than under 1.26.6's (a multi-value return with a composite literal inside a select/case reindents differently). --new-from-rev correctly excludes it since the affected line isn't part of any diff in this branch, so no CI gate fails on it. It is an active check, not an absent one — it simply isn't triggered against a line this branch touches. Left unformatted: out of scope for a toolchain-pin change. - During earlier measurement (not the two required runs above, both of which were clean), one go1.27.1 run of `go test ./internal/consensus/...` hit a failure in TestPoC_HeightVoteSet_UnboundedRoundAllocation (retained 308 bytes per message against a <149 threshold), not one of the two previously-known flaky tests in this package. Isolated reruns of just this test passed 5/5 under go1.27.1 and 3/3 under go1.26.6. The 1.26.6 baseline never ran this test under equivalent full-package concurrent load, so this is not a like-for-like comparison between Go versions — left unresolved and not claimed to be version-related. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
Go 1.27's gofmt reindents a multi-value return containing a composite literal inside a select/case block differently than Go 1.26's gofmt does: the composite literal body and the trailing fmt.Errorf continuation drop one level of indentation. Formatted here with the go1.27.1 toolchain's own gofmt -w -s (`go env GOROOT`'s bin/gofmt under this branch's now-pinned toolchain) — the same flags `make format`'s gofmt step uses; `-s` (simplify) produces an identical diff to plain gofmt here, so it isn't smuggling in any rewrite beyond the reindent. Ran the full-repository gofmt -l -s sweep under go1.27.1 first, using make format's own exclusions (skip *.pb.go, *pb_test.go, .git) rather than fixing only the single file golangci-lint's filtered lint run had named: internal/rpc/core/mempool.go was the only file the sweep flagged, before and after -s. Did not run the rest of `make format` (golines, goimports) since those are separate tools operating on unrelated lines (line-wrapping, import grouping) — out of scope for a pure gofmt-drift fix. This repository has no standalone gofmt gate that this drift was failing: .golangci.yml's `formatters.enable` list does include gofmt (a distinct section from `linters.enable` in golangci-lint v2's config schema — it is an active check, not an absent one), but the one finding it produced was on a line outside any diff in this branch, so `--new-from-rev` filtered it and no CI gate was failing. `make format` itself writes rather than checks, so it enforces nothing on its own either. This commit removes latent formatting drift ahead of it mattering, not a fix for a red gate. Confirmed asymmetric in both directions: after this reformat, `gofmt -l -s` is clean under go1.27.1 (this branch's pinned toolchain) but go1.26.6's gofmt now wants the same lines re-indented back the other way. Anyone building this file with a local Go 1.26.x toolchain and running gofmt/make format against it will see a diff again — expected, since the two Go versions' gofmt disagree on this construct in both directions, and this branch is pinned to 1.27.1. No logic changes: the diff is pure reindentation of already-existing lines, confirmed via `gofmt -d` before applying. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
c87700a to
8706479
Compare
Takes the 1.7 line to Go 1.27.1, in four commits ordered so that every intermediate state is coherent.
Two tools in this repository are older than Go 1.27 and break under it, and two tests depend on Go 1.26 behaviour that 1.27 changed. All four were found by running the gates rather than by reading release notes. Every one of them is ordered ahead of the toolchain bump, and each passes at both 1.26.6 and 1.27.1 — so no commit in this stack leaves a gate red or a test failing, in either direction.
Why the first commit exists at all
govulncheckfails onv1.7-devHEAD itself — not only on PR branches — with six Go standard-library advisories, allFound in: go1.26.5 / Fixed in: go1.26.6:GO-2026-6218(net/url),GO-2026-6091(html/template),GO-2026-6090(crypto/tls),GO-2026-6089(net/http, ×2),GO-2026-5972(encoding/asn1). #1417 closed these on the branch now calledv1.8-devand never reached 1.7. It is cherry-picked here with its provenance intact rather than rewritten, so the port is verifiable by diff.Why the lint bump must come second
golangci-lint v2.12.2does not report new findings under Go 1.27.1 — it crashes.buildirpanics inside staticcheck's SSA/IR builder (honnef.co/go/[email protected]) while analysing the standard library packageinternal/poll:Deterministic, reproduced twice, and not a stale-binary artefact — golangci-lint was rebuilt with the 1.27.1 toolchain and panics identically.
lint.yml'sversion: v2.12selector resolves to the newest 2.12.x, which is v2.12.2, so merging the toolchain bump without this commit would leave the lint job unable to run at all.v2.12.2 is from May; v2.13.0 shipped on 2026-08-19, the same day as Go 1.27.0. The 2.13 line is the Go 1.27-aware one.
Measured at both toolchains rather than assumed:
--new-from-rev)The two changes are therefore independent — v2.13.2 is clean at both versions, so the lint bump is safe on its own and could have shipped separately. It is ordered first here so that no commit in this stack leaves the tree in a state where the lint job cannot run: a bisect, or a revert of the top commits, never lands on a broken gate.
Disabling staticcheck was considered and rejected. It is the linter that catches the
QF1008class this branch's other work depends on; turning it off to make a version bump land would trade a working gate for a green tick.Why the mockery bump must come third
check-mockspasses at the 1.26.6 commit and fails at the 1.27.1 one. The failure is not in this repository's source:mockery's
go/packagesloader fails to attach type information to a transitively imported package when driven by the go1.27.1 toolchain.check-generated.ymlpinnedMOCKERY=3.7.0, released 2026-03-06 — five months before Go 1.27.0.v3.7.4shipped 2026-08-23, four days after it. The same relationship as the linter, found the same way.The CI logs cannot show this. The step runs
make mockery 2>/dev/null, so stderr is discarded and the job reports onlyexit code 2. The error had to be reproduced locally under CI-matching conditions (GOTOOLCHAIN=local, a real 1.27.1 binary, and the BLS cgo flags — without those a different and misleading error aboutencoding/hexappears instead).The commit bumps both pin sites —
check-generated.ymlandscripts/mockery_generate.sh— and commits the regenerated mocks. It has to do both: the gate isgit diff --exit-codeafter regenerating, so bumping the pin without regenerating and regenerating without bumping the pin each leave the job red.25 mock files change, 192 insertions / 192 deletions, and the change is cosmetic:
interface{}→any(173 occurrences, an identical type since Go 1.18) and generated parameter names recovering their real source names in place ofv/vsplaceholders. No method set changes, no altered mock behaviour. That was verified by building and running the consensus suite against the regenerated mocks rather than by reading the diff — generated code that compiles and whose consumers still pass is a check reading cannot give.v3.7.4 produces byte-identical output under both go1.26.6 and go1.27.1, so the 25-file diff comes from mockery's own codegen version and not from the toolchain. This commit therefore stands on its own and could ship independently, exactly like the lint bump.
The gate itself was simulated at the final head — regenerate with v3.7.4 under go1.27.1, then
git diff --exit-code— and exits 0 with zero drift.Why the two test commits come next
tests (05)fails at the 1.27.1 commit and passes at 1.26.6. Three failures inrpc/jsonrpc/server, of two different kinds.Two are assertions on standard-library wording. Go 1.27's
encoding/jsonchanged how it reports a malformedjson.Number:TestRPCParamsmatched on"invalid number",TestParseURI/Decodeon"invalid number literal". The behaviour did not change — the input is still rejected as-32602 Invalid params. Only the sentence moved.The fix is not to substitute the new phrase, which would swap one version-specific assertion for another and break for anyone on 1.26.
RPCFunc.parseParamsroutes every decode failure throughinvalidParamsError, which setsMessageto our ownCodeInvalidParams.String()— literally"Invalid params"— and puts the standard library's text only inData. The tests now assert on that. Checked against the sibling rows in the same tables:"Method not found"and the malformed-JSON row use different codes and different messages, so widening these two rows matches nothing it should not. This is stricter than what it replaces — the old substring could match any error whose text happened to contain the phrase, while the new one names the error family.One is a real behaviour change with a documented mechanism.
TestMaxOpenConnectionsfailed 5/5 at 1.27.1 and passed 5/5 at 1.26.6, deterministically, leaking twonet/httpserver goroutines parked inbufio.Reader.Peek— idle keep-alive connections.Go 1.27's release notes name the cause: HTTP/1
Response.Bodynow automatically drains unread content on Close, to allow connection reuse. The test never reads the response bodies. Under 1.26 closing an unread body poisoned the connection, so the transport closed the socket and the server goroutine exited; under 1.27 the connection is healthy, returns to the idle pool, and both ends stay open.Reading the body explicitly does not fix it — that was measured, not assumed: patching the test to drain before
Closestill leaks 3/3, because 1.27 already drains. The connection surviving is the cause, not its being dirty. The fix hoists a single sharedhttp.Clientand callsCloseIdleConnections()after the wait group. Verified the assertion is not weakened by sharing: instrumenting the handler shows peak concurrent connections is still exactly the configured maximum, since concurrent in-flight requests each need their own connection and pooling only governs what happens after they go idle.-raceclean.Both commits pass at 1.26.6 and at 1.27.1, which is what allows them to sit ahead of the toolchain bump.
The toolchain bump
Sixteen files:
go.mod, eight CI workflow pins, three Dockerfiles, four documentation references. The documentation sites matter — they are what a contributor reads to decide which toolchain to install, and omitting them would leave CI and the setup instructions disagreeing, a divergence no gate detects.Measured across the change:
go vet ./...— byte-identical before and after, diffed to zero output. The same four pre-existing findings (threefmt.Errorfintest/e2e/pkg/testnet.go, one address format indash/quorum/nodeid_resolver.go). No new vet strictness appeared, which was the leading risk of crossing a minor version.govulncheck ./...— identical sets on both sides. 0 standard-library vulnerabilities affecting this code, and the same four dependency-only findings (GO-2026-6355,6354,6303,5932) unchanged. 1.27.1 neither opens nor closes anything here relative to 1.26.6.go build ./...clean;go test ./internal/consensus/... -count=1green on both required runs of the final stack.All of it ran under a genuine go1.27.1:
GOTOOLCHAIN=autoresolves from the module's owngoline, so the commands executed against the version this PR pins rather than whatever is onPATH.One unresolved observation, stated rather than omitted. During measurement — not in the two required runs —
TestPoC_HeightVoteSet_UnboundedRoundAllocationfailed once on a memory-accounting margin. It then passed 5/5 in isolation at 1.27.1 and 3/3 at 1.26.6. No version claim is made: the 1.26.6 baseline never ran it under equivalent full-package load, so the two are not comparable. It is recorded as unresolved.The formatting commit
Go 1.27's
gofmtreindents a multi-valuereturncontaining a composite literal inside aselect/caseblock differently from Go 1.26's. One file in the repository is affected, found by a fullgofmt -l -ssweep under 1.27.1 usingmake format's own exclusions — not by fixing only the file the filtered lint run happened to name. The diff is four lines of pure reindentation;-sproduces an identical result to plaingofmt, so no simplification is smuggled in.This is not a fix for a red gate.
.golangci.yml'sformatters.enablelist does includegofmt— a separate section fromlinters.enablein golangci-lint v2's schema, so it is an active check — but its one finding falls on a line no diff in this branch touches, so--new-from-revfilters it and nothing fails. The commit removes the drift before it matters: the filter stops covering those lines the moment anyone edits near them, and they would then fail on formatting they did not introduce, under a toolchain this branch pinned.Known asymmetry, confirmed in both directions: after the reformat,
gofmt -l -sis clean under go1.27.1 and go1.26.6'sgofmtnow wants those lines back the other way. Anyone building this file with a local Go 1.26.x and runningmake formatwill see a diff. That is inherent to the two versions disagreeing on this construct, and this branch is pinned to 1.27.1.🤖 Generated with Claude Code
https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj