Repository navigation
chore(mise): take the Go version from go.mod natively - #4075
Conversation
Replace the .mise-go-version.sh script and the templated GO_VERSION env variable with mise's built-in support for go.mod as an idiomatic version file. mise uses the toolchain directive if there is one and falls back to the go directive, like the script did. The exec() template ran the script relative to the current directory, which broke config parsing in mise commands that load the config from elsewhere, such as upgrading tools. Assisted-by: Claude Code:claude-opus-5-5
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Coverage variation | ✅ +0.01% coverage variation (-1.00%) |
| Diff coverage | ✅ ∅ diff coverage |
Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (839838a) 94308 28337 30.05% Head commit (d662f01) 94308 (+0) 28351 (+14) 30.06% (+0.01%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>
Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#4075) 0 0 ∅ (not applicable) Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
@fschade Thanks. It isn't new actually, mise has had it since 2025.4.6. I had tried it out before going for the script, but didn't apply it correctly back then. Set up like this, it works, and it also gets rid of the warnings when upgrading tools with |
Description
mise reads the Go version from
go.moditself whengois listed in theidiomatic_version_file_enable_toolssetting: it uses thetoolchaindirective if there is one and falls back to the
godirective, like.mise-go-version.shdid (added in #3432).This replaces the script and the templated
GO_VERSIONenv variable withthat setting in
mise.toml, sogo.modstays the single source of the Goversion without a script.
Commands that load all the configs mise tracks, such as
mise upgradeormise prune, don't render the[env]template, so they failed to parsethe Go version of every opencloud checkout:
As a result,
mise prunealso didn't see which Go version the checkoutsneed.
How to test
mise ls --currentshowsgo 1.26.0withgo.modas its sourcemise exec -- go versionprintsgo1.26.0~:mise prune --dry-runshows no"error loading tracked config file" warning for this checkout, and lists
go 1.26.0 as required by its
go.modAI assistance: Claude Code (claude-opus-5-5) found the mise setting,
wrote the change and this description, and ran the checks above.