name: update-go-version description: Guides through updating the Go version (go and toolchain) across all modules, workspaces, Dockerfiles, and scripts in Config Connector.
Upgrading Go Version in KCC
This skill outlines the process for updating the Go version in the Config Connector (KCC) codebase.
Workflow
1. Update Go Modules and Workspaces
Update each go.mod file and the root go.work file.
Specifically, set the go directive to the minor version (e.g., 1.26) and the toolchain directive to the precise patch version (e.g., go1.26.4).
The affected files include:
go.mod(root)go.work(root)mockgcp/go.modmockgcp/tools/patch-proto/go.moddev/tools/controllerbuilder/go.moddev/tools/crd-mcp-server/go.modexperiments/tools/licensescan/go.modexperiments/kubectl-plan/go.modexperiments/kompanion/go.mod
2. Update Dockerfiles
Update base and builder images in Dockerfiles to target the precise patch version (e.g., golang:1.26.4).
Key files to check/update:
operator/Dockerfilebuild/tooling/Dockerfilebuild/builder/Dockerfile.devcontainer/Dockerfile
3. Update Setup Scripts
Update Go version variables in environment setup scripts.
scripts/environment-setup/golang-setup.sh(e.g., updateGO_VERSION="1.26.1"to"1.26.4")
4. Tidy and Format
Once the files are updated, run go mod tidy on all modified modules to ensure the dependency graph is fully resolved and compliant with the updated toolchain.
Alternatively, run:
make ready-pr
which runs presubmits, formatting, and tidying.
5. Validate
Validate that the codebase builds and tests pass under the updated version configuration.
go test ./...