Skip to content

chore: upgrade Go to 1.27.3 and update dependencies - #7102

Merged
ti-chi-bot[bot] merged 2 commits into
pingcap:mainfrom
liubog2008:upgrade-go-127
Oct 24, 2026
Merged

ti-chi-bot[bot] merged 2 commits into
pingcap:mainfrom
liubog2008:upgrade-go-127

Conversation

@liubog2008

@liubog2008 liubog2008 commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Upgrade the Go toolchain and Docker builder image to 1.27.3, with the verified multi-platform image digest. Raise the Go directive to 1.27.0 across all 14 modules and refresh dependencies using hack/update-modules.sh, following #7017.

Go 1.27 vet detects printf wrappers through interfaces. Fix 172 task-message formatting calls by replacing unsupported %w with %v and passing dynamic messages through a constant %s format.

Upgrade E2E now uses the old checkout's kind wrapper to load both its prestop-checker and operator images. This avoids invoking the current branch's Go 1.27 tool module from an older checkout that selects Go 1.25.

Validation:

  • make build
  • make unit (including race detection; run outside the sandbox for local HTTP test servers)
  • cd api && go test -race ./...
  • make tidy (no additional go.mod/go.sum changes)
  • git diff --check
  • After rebasing onto upstream/main: bash -n hack/lib/e2e.sh and git diff --check upstream/main...HEAD

Full lint, generated-file verification, and E2E tests were not run locally.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected error-message formatting across cluster operations. Failure messages now handle percent characters as literal text and consistently display error details.
  • Chores
    • Updated the Go toolchain and supporting build and validation components. Also corrected the end-to-end test setup to use the appropriate version of the cluster tool when preparing older-version test images.

@github-actions github-actions Bot added the v2 for operator v2 label Oct 22, 2026
@ti-chi-bot ti-chi-bot Bot added the size/XXL label Oct 22, 2026
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 03fb0345-d677-4931-b433-79bfa7842e0e
📥 Commits

Reviewing files that changed from the base of the PR and between e432f6a and 74f4efe.

⛔ Files ignored due to path filters: 13
  • api/go.sum is excluded by !**/*.sum
  • go.sum is excluded by !**/*.sum
  • tests/validation/go.sum is excluded by !**/*.sum
  • tools/controller-gen/go.sum is excluded by !**/*.sum
  • tools/deepcopy-gen/go.sum is excluded by !**/*.sum
  • tools/ginkgo/go.sum is excluded by !**/*.sum
  • tools/golangci-lint/go.sum is excluded by !**/*.sum
  • tools/helm/go.sum is excluded by !**/*.sum
  • tools/kind/go.sum is excluded by !**/*.sum
  • tools/kubectl/go.sum is excluded by !**/*.sum
  • tools/license-eye/go.sum is excluded by !**/*.sum
  • tools/mockgen/go.sum is excluded by !**/*.sum
  • tools/register-gen/go.sum is excluded by !**/*.sum
📒 Files selected for processing: 1
  • hack/lib/e2e.sh

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Walkthrough

The PR raises Go version declarations to 1.27, updates module dependencies and the Docker builder image, and changes error formatting in controller task results. It also changes the kind binary used to build and load artifacts in the old-version end-to-end setup.

Changes: Controller task error formatting

Layer / File(s) Summary
Format task errors without wrapping
pkg/controllers/*/tasks/*.go
Many controller task failure messages use %v instead of %w. These messages no longer wrap the underlying errors.
Pass messages as formatting arguments
pkg/controllers/*/tasks/*.go
Controller task results pass dynamic error or status messages through explicit format strings such as %s, rather than treating those messages as format strings.

Go toolchain and dependencies

Layer / File(s) Summary
Update Go versions and module dependencies
go.mod, api/go.mod, tests/validation/go.mod, tools/*/go.mod, image/Dockerfile
Module Go versions advance to 1.27.0. Dependency declarations change across modules, and the Docker builder image changes to golang:1.27.3.

Old-version end-to-end setup

Layer / File(s) Summary
Use the old checkout kind binary
hack/lib/e2e.sh
The script uses the old checkout's kind binary to build the prestop-checker and load the old operator image.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Suggested labels: size/XL

Suggested reviewers: csuzhangxc

Merge Risk: ⚪ Minimal · up to 74f4e

No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 27.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 48 functions across 51 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "chore: upgrade Go to 1.27.3 and update dependencies" matches the main change. The diff raises the Go toolchain in image/Dockerfile to golang:1.27.3, raises the go directive to 1.27.0 across…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "chore: upgrade Go to 1.27.3 and update dependencies" matches the main change. The diff raises the Go toolchain in image/Dockerfile to golang:1.27.3, raises the go directive to 1.27.0 across the module files, and refreshes dependencies. The title is short, specific, and states the primary change. The changeset also includes about 172 task-message formatting changes (%w to %v and similar) for Go 1.27 vet findings, which the title does not mention. That is expected because the title need not cover every detail.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

A rabbit checks the task results with care
And finds %v where wrapped errors were
New Go tools hop along the path
Old kind loads the image at last
Dependencies settle in their burrow
The rabbit nods, then bounds tomorrow

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

It is a broad Go toolchain upgrade and dependency refresh across 14 modules whose build/test/lint compatibility cannot be verified in this environment and which the author notes was not fully validated locally, warranting human review.

No open issues 🎉

What changed in this PR

This PR upgrades the Go toolchain and Docker builder image to 1.27.3, raises the go directive to 1.27.0 across all 14 Go modules, and refreshes dependencies via hack/update-modules.sh (following #7017). Go 1.27's vet now detects printf-style wrappers through interfaces, which flags the task.*().With(...) message helpers; the PR adapts ~172 call sites accordingly. Since With(format string, args ...any) delegates to fmt.Sprintf, %w was never actually supported there (it produced malformed %!w(...) output), so the conversions are a correct, net-positive fix rather than a loss of error wrapping.

Changes:

  • Bump Go toolchain to 1.27.3 (Dockerfile digest-pinned) and go directive to 1.27.0 in every module; refresh go.mod/go.sum dependencies.
  • Replace unsupported %w with %v in task.Fail()/Complete()/Retry().With(...) messages.
  • Wrap dynamic messages passed to With(...) with a constant "%s" format (e.g. .With("%s", fmt.Sprintf(...)), .With("%s", err.Error())) to satisfy vet's printf check.
File Description
image/​Dockerfile Bumps builder image to golang:1.27.3 with pinned digest
go.mod /​ go.sum (root, api, tests/​validation, tools/​*) Raises go directive to 1.27.0 and refreshes dependency versions across all modules
pkg/​controllers/​*/​tasks/​*.go (updater, svc, status, pod, cm, ctx, etc.) Converts %w→%v and wraps dynamic With(...) messages with "%s" to satisfy Go 1.27 vet
pkg/​controllers/​cluster/​tasks/​feature.go, ctx.go Bulk %w→%v conversions in per-group feature/list error messages
pkg/​controllers/​common/​task.go, task_*.go, revision.go Wraps err.Error()/dynamic strings with "%s" and %w→%v
pkg/​controllers/​tidb/​tasks/​pod.go Additional gofmt reindentation of defaultSlowLogVolumeAndMount (semantics unchanged)

Review effort: Balanced

@codecov-commenter

codecov-commenter commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 36.31285% with 114 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.00%. Comparing base (1e0c4d3) to head (74f4efe).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7102      +/-   ##
==========================================
- Coverage   42.49%   42.00%   -0.49%     
==========================================
  Files         447      447              
  Lines       25923    22917    -3006     
==========================================
- Hits        11016     9627    -1389     
+ Misses      14907    13290    -1617     
Flag Coverage Δ
unittest 42.00% <36.31%> (-0.49%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@fgksgf fgksgf 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.

Thanks! Reviewed the toolchain bump and the printf sweep — the PR description's claims all check out:

  • Exactly 172 .With( call sites changed (136 %w→%v in constant formats, 36 dynamic messages passed through a constant %s); no remaining %w or non-constant-format .With( calls left in the repo — the sweep is complete.
  • All 14 modules at go 1.27.0, root pinned to toolchain go1.27.3; CI workflows use go-version-file: ./go.mod, so nothing else contradicts the bump. Builder image digest-pinned to 1.27.3, --platform=$BUILDPLATFORM unchanged.
  • The dependency refresh looks like a plain hack/update-modules.sh result: k8s.io/controller-runtime and k8s.io/* unchanged, only patch/minor moves (grpc, ginkgo/gomega, testify, otelgrpc, cloud SDKs), no replace additions/removals.

Since With is fmt.Sprintf-based, %w never rendered an error chain there, so %w→%v is purely a message-rendering fix with no loss of error identity — good.

One non-blocking follow-up: docs/CONTRIBUTING.md still says "install Go 1.23.x" — worth a tiny docs pass whenever convenient.

LGTM.

pdCfg, err := getPDConfig(ctx, pdc.Underlay())
if err != nil {
return task.Fail().With(err.Error())
return task.Fail().With("%s", err.Error())

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.

nit (non-blocking): With("%v", err) would be a bit shorter and matches the direct-format form used a few lines below in the same function (line 240). The %s + err.Error() wrap is fine for a mechanical pass — identical output either way.

Name: v1alpha1.VolumeNameTiDBSlowLogDefault,
MountPath: v1alpha1.DirPathTiDBSlowLogDefault,
}
Name: v1alpha1.VolumeNameTiDBSlowLogDefault,

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.

Flagging for the record: this hunk is indentation-only (gofmt re-canonicalization of the composite literal), unrelated to the printf fix. Fine to keep here since the file is touched anyway — just noting it so nobody reads it as a logic change.

@ti-chi-bot ti-chi-bot Bot added the lgtm label Oct 22, 2026
@ti-chi-bot

ti-chi-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fgksgf

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

The pull request process is described 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

@ti-chi-bot

ti-chi-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

[LGTM Timeline notifier]

Timeline:

  • 2026-10-22 10:19:27.223687769 +0000 UTC m=+24704.715400028: ☑️ agreed by fgksgf.

@ti-chi-bot ti-chi-bot Bot added the approved label Oct 22, 2026
@liubog2008

Copy link
Copy Markdown
Member Author

/test pull-e2e

4 similar comments
@liubog2008

Copy link
Copy Markdown
Member Author

/test pull-e2e

@liubog2008

Copy link
Copy Markdown
Member Author

/test pull-e2e

@liubog2008

Copy link
Copy Markdown
Member Author

/test pull-e2e

@liubog2008

Copy link
Copy Markdown
Member Author

/test pull-e2e

@liubog2008

Copy link
Copy Markdown
Member Author

/retest

@liubog2008

Copy link
Copy Markdown
Member Author

/hold

@liubog2008

Copy link
Copy Markdown
Member Author

/unhold

@ti-chi-bot
ti-chi-bot Bot merged commit e81e472 into pingcap:main Oct 24, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants