Skip to content

Bump go 1.27.1 - #22373

Open
pjsharath28 wants to merge 5 commits into
etcd-io:mainfrom
pjsharath28:bump-go-1.27.1
Open

Bump go 1.27.1#22373
pjsharath28 wants to merge 5 commits into
etcd-io:mainfrom
pjsharath28:bump-go-1.27.1

Conversation

@pjsharath28

Copy link
Copy Markdown
Member

Part of #22372

Signed-off-by: Sharath P J <pjsharath28@gmail.com>
Signed-off-by: Sharath P J <pjsharath28@gmail.com>
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.97%. Comparing base (b655785) to head (f043a5b).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
server/etcdserver/api/v2store/store.go 0.00% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
cache/cache.go 91.30% <100.00%> (+3.60%) ⬆️
server/embed/etcd.go 80.99% <100.00%> (+5.25%) ⬆️
server/etcdserver/metrics.go 72.54% <100.00%> (+5.27%) ⬆️
server/etcdserver/api/v2store/store.go 88.39% <0.00%> (+5.27%) ⬆️

... and 441 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #22373      +/-   ##
==========================================
+ Coverage   69.73%   72.97%   +3.23%     
==========================================
  Files         448      448              
  Lines       38058    31556    -6502     
==========================================
- Hits        26541    23028    -3513     
+ Misses      10101     8525    -1576     
+ Partials     1416        3    -1413     

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b655785...f043a5b. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pjsharath28

Copy link
Copy Markdown
Member Author

Commit 1 — Go version bump
Updates .go-version, all go.mod files, and go.work to Go 1.27.1.

Commit 2 — fix: use value dereference for v2error.Error with %w
Caught by govet during the upgrade. n.Write() returns a pointer but
Error() is on the value receiver, so passing the pointer to %w
defeats errors.Is/errors.As. Dereferencing fixes it.

…0.8.1

Signed-off-by: Sharath P J <pjsharath28@gmail.com>
@pjsharath28

Copy link
Copy Markdown
Member Author

Commit 3 - fix: address staticcheck SA4023 warnings
Bumped honnef.co/go/tools to v0.8.1 to support Go 1.27. This
surfaced 3 new lint warnings which are fixed in this commit:

  • cache/cache.go — removed a redundant nil check
  • metrics.go, embed/etcd.go — suppressed false positives
    (these functions intentionally always fail on non-linux)

Signed-off-by: Sharath P J <pjsharath28@gmail.com>
@pjsharath28

Copy link
Copy Markdown
Member Author

Commit 4 - test: update TestLogRotation expected error for Go 1.27 json/v2

Go 1.27 enables encoding/json/v2 by default. The v2 implementation
formats error paths for embedded structs differently — it drops the
intermediate embedded type name:

  • Go 1.26: logRotationConfig.Logger.maxsize
  • Go 1.27: logRotationConfig.maxsize

No production code changed - just updated the hardcoded expected string
in the test to match the new format.

…hesis Dockerfile

Signed-off-by: Sharath P J <pjsharath28@gmail.com>
@pjsharath28

Copy link
Copy Markdown
Member Author

Commit 5 - fix: sync go.work and go.mod versions in antithesis Dockerfile

The Dockerfile clones from main but copies pkg from the current
branch. During a Go version bump, the cloned go.work/go.mod files
are still on the old version while the copied pkg/go.mod requires the
new one — causing go get to fail. Fixed by syncing go.work and all
go.mod files to match the copied pkg/go.mod after the copy step.

@pjsharath28
pjsharath28 marked this pull request as ready for review September 2, 2026 09:14
@pjsharath28

Copy link
Copy Markdown
Member Author

/retest

Comment on lines +14 to +19
# Sync go.work and all go.mod versions to match the copied pkg module,
# since the cloned branch may be behind the copied pkg module requirements.
RUN eval $(grep -E '^(go|toolchain) ' tests/antithesis/pkg/go.mod | awk '{print toupper($1)"="$2}') && \
go work edit -go=${GO} -toolchain=${TOOLCHAIN} && \
find . -name 'go.mod' -not -path './tests/antithesis/*' -exec \
go mod edit -go=${GO} -toolchain=${TOOLCHAIN} {} \;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is line 9 not working anymore? I remember that it failed in a previous minor version bump, and the solution was to set the environment variable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix in 4e39cdf was for a patch bump mismatch (base image 1.25.0 vs toolchain 1.25.1) where go env -w was enough since the go directive didn't need to change.

In this case though, the copied pkg/go.mod requires go 1.27 while the cloned go.work still says go 1.26, so we also need go work edit + go mod edit to update the directive itself. Happy to revisit if there's a cleaner way to handle this!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, got it. I wanted to replace this with the utilities we already have, something like:

RUN awk 'match($0, /^toolchain go/) {gsub(/go/, "", $2); print $2}' tests/antithesis/pkg/go.mod > .go-version && make sync-toolchain-directive

But the problem is that we would only update the toolchain, not the go directive.

@ivanvc

ivanvc commented Sep 3, 2026

Copy link
Copy Markdown
Member

Huh, in #22302 I was getting errors from using an old golangci-lint version. We haven't updated it (#22363), but for some reason it works on your branch 🤔

@ivanvc ivanvc mentioned this pull request Sep 3, 2026
19 tasks
@ivanvc

ivanvc commented Sep 4, 2026

Copy link
Copy Markdown
Member

Can a second pair of eyes look at this? Especially the last three commits bdc41f1, 178320b, f043a5b

/lgtm
/cc @ahrtr @fuweid @serathius

@fuweid fuweid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please squash the commits into one? Don't think we need 5 commits to bump goversion thanks

@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pjsharath28
Once this PR has been reviewed and has the lgtm label, please ask for approval from ivanvc. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pjsharath28

Copy link
Copy Markdown
Member Author

Could you please squash the commits into one? Don't think we need 5 commits to bump goversion thanks

Just thought it'd be easier to keep them separate for the reviewers. Once everything looks good, I'm happy to squash. Hope that would be fine.

Comment thread cache/cache.go
if err := c.getWatch(); err != nil {
fmt.Printf("getWatch failed, will retry after %v: %v\n", backoff, err)
}
err := c.getWatch()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest using comment instead of changing code

//nolint:staticcheck // SA4023: Related diagnostic for the defensive nil check in getWatchLoop.

COPY pkg /etcd/tests/antithesis/pkg
# Sync go.work and all go.mod versions to match the copied pkg module,
# since the cloned branch may be behind the copied pkg module requirements.
RUN eval $(grep -E '^(go|toolchain) ' tests/antithesis/pkg/go.mod | awk '{print toupper($1)"="$2}') && \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can try this

# The copied module may require a newer Go version than the cloned workspace.
  RUN if [ -f go.work ]; then go work use; fi

# cloning etcd
ARG REF=main
RUN git clone --depth=1 https://github.com/etcd-io/etcd.git --branch=${REF} /etcd
RUN go env -w GOTOOLCHAIN="go$(cat .go-version)"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can try this because GO_IMAGE_TAG is aligned with .go-version in root.

# Use the selected build image's toolchain, including when building older refs.
ENV GOTOOLCHAIN=local

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants