name: bump-go-version description: Bumps the Go version to the latest release across go.mod, tools.mod, and Dockerfiles.
Bump Go Version Skill
Purpose
This skill guides AI agents to update the Go version used throughout the agent-sandbox repository to the latest stable Go release. It ensures consistency across Go module definitions (go.mod, tools.mod, toolchain) and container image base layers (Dockerfile).
Instructions
Determine the Latest Go Version:
- Run the helper script provided with this skill to fetch the latest stable Go release version string (e.g.,
go1.26.3). Execute this from the repository root:./.agents/skills/bump-go-version/scripts/get-latest-go - Note the exact version strings needed:
- For
go mod edit -go, use the numeric format1.x(e.g.,1.26). This is the language version and should not specify a patch version. - For
go mod edit -toolchain, use thego1.x.yformat (e.g.,go1.26.3). - For
Dockerfiles, identify the corresponding officialgolangimage tag (e.g.,golang:1.26.3).
- For
- Run the helper script provided with this skill to fetch the latest stable Go release version string (e.g.,
Locate Target Files and Context:
- Run the helper script provided with this skill to locate all relevant files and inspect their current
FROM,go, andtoolchainlines. Execute this from the repository root:./.agents/skills/bump-go-version/scripts/find-files - The script will output the list of all
go.mod,tools.mod, andDockerfile*files in the repository along with their current version directives. (Note:site/go.modis automatically excluded by the script).
- Run the helper script provided with this skill to locate all relevant files and inspect their current
Update Go Module Directives:
- By default, only update the
toolchaindirective in eachgo.modandtools.modfile usinggo mod edit. Do not update thegolanguage version directive by default, as bumping the minimum language version forces that requirement onto all downstream consumers of our modules. - Example (Default Workflow):
go mod edit -toolchain=go1.26.3 go.mod go mod edit -toolchain=go1.26.3 tools.mod - Optional Language Version Bump: If the user explicitly requests bumping the Go language version (e.g., when adopting new language features), update the
godirective usinggo mod edit -go=1.x(specifying only the major/minor version, e.g.,1.26, without a patch version).go mod edit -go=1.26 go.mod - CRITICAL NOTE: Do NOT update or modify
site/go.mod.site/go.modis a Hugo theme configuration file, not a Go code module, and modifying it or running Go tools against it will break the documentation build.
- By default, only update the
Update Dockerfiles:
- For each
Dockerfile(orDockerfile.*) identified by the script, inspect the file for anyFROM golang:<version>orFROM --platform=$BUILDPLATFORM golang:<version>lines. - Update the version tag to match the latest Go release (e.g., change
golang:1.26.2togolang:1.26.3). - Do not modify other base images (e.g.,
debian,distroless) unless specifically required.
- For each
Verify and Test:
- After updating the files, run
go mod tidyin directories containinggo.modfiles to verify module resolution and clean up dependencies. - CRITICAL NOTE: Do NOT run
go mod tidyinsidesite/. Running Go's nativego mod tidyin the Hugo site directory will fail or strip theme dependencies. - Run
make all(which includes lint(ing), building, and unit testing) from the repository root to ensure the project builds and tests pass successfully with the new Go version. - Ensure no unintended formatting changes or unrelated modifications are introduced.
- After updating the files, run
Helper Scripts
scripts/get-latest-go: Fetches the latest stable Go release version string.scripts/find-files: Scans the repository and outputs allgo.mod,tools.mod, andDockerfilefiles along with their current version context lines (excludingsite/go.mod).
References
- Go Release History
- Project rules (as documented in
AGENTS.mdandCONTRIBUTING.md)