go-runtime-updater
Installation
SKILL.md
Go Runtime Updater
1. Determine The Target Version
If the user did not give an explicit target, determine the latest exact stable Go version first.
- Check pkg.go.dev/std and read the
Version: goX.Y.Zline. Treat that as the latest exact stable release. - Do not infer the latest Go version from arbitrary
pkg.go.devsearch results or a random package page. Usepkg.go.dev/std. - Derive the latest release line from that exact version by replacing the patch with
.0. Example:go1.26.1maps to release line1.26.0. - Derive the previous major release line by subtracting
1from the minor version and using patch.0. Example: if the latest release line is1.26.0, the previous major release line is1.25.0. - When updating a
godirective, use the relevant release line with patch.0, not the latest patch release.
2. Update go.mod And go.work
- If a
toolchain go...directive exists and the user wants the latest version, update onlytoolchainto the latest exact release. Do not changego. Usego mod edit -toolchain=goX.Y.Zorgo work edit -toolchain=goX.Y.Z. - If a
toolchain go...directive exists and the user wants a specific version, update onlytoolchainto that version. Do not changego. Usego mod edit -toolchain=goX.Y.Zorgo work edit -toolchain=goX.Y.Z. - If there is no
toolchaindirective and the user wants a specific version that is not the latest release line, updategoto that release line with patch.0. Usego mod edit -go=X.Y.0orgo work edit -go=X.Y.0. - If there is no
toolchaindirective and the user wants the latest version or latest major version, ask whether they want to raise the minimum supported Go version or keep compatibility by adding atoolchaindirective instead. - Do not add a new
toolchaindirective unless the user asks for it or confirms that they want the latest toolchain without raising the minimum supported Go version. - Preserve formatting and unrelated directives.
3. Best Practice
gois the minimum required Go version.toolchainis a suggested toolchain for working in the module or workspace.- Do not add
toolchainby default; use it when the project wants a newer preferred toolchain without changing the minimum supported Go version.
4. Examples
- Latest exact release is
go1.26.1, file hasgo 1.25.0andtoolchain go1.25.7: update only totoolchain go1.26.1. - User requests
1.24.6, file has onlygo 1.23.0: update togo 1.24.0. - User requests "latest", file has only
go 1.25.0: ask whether to change the minimum supported version togo 1.26.0or addtoolchain go1.26.1. - Latest exact release is
go1.26.1: the previous major release line is1.25.0.
Related skills
More from stefafafan/skills
commit-message-writer
Draft conventional commit messages that explain why a change exists instead of listing what changed. Use when trying to write a git commit message.
8pnpm-action-setup-cache
Update GitHub Actions workflows to use pnpm/action-setup cache support introduced in v4.3.0. Use when creating or editing workflow YAML files that install pnpm, especially when they use actions/setup-node cache: pnpm or actions/cache entries for pnpm store paths.
1