Skip to content

chore(mise): take the Go version from go.mod natively - #4075

Merged
pbleser-oc merged 1 commit into
opencloud-eu:mainfrom
pbleser-oc:chore/mise-go-version-from-go-mod
Nov 20, 2026
Merged

pbleser-oc merged 1 commit into
opencloud-eu:mainfrom
pbleser-oc:chore/mise-go-version-from-go-mod

Conversation

@pbleser-oc

Copy link
Copy Markdown
Member

Description

mise reads the Go version from go.mod itself when go is listed in the
idiomatic_version_file_enable_tools setting: it uses the toolchain
directive if there is one and falls back to the go directive, like
.mise-go-version.sh did (added in #3432).

This replaces the script and the templated GO_VERSION env variable with
that setting in mise.toml, so go.mod stays the single source of the Go
version without a script.

Commands that load all the configs mise tracks, such as mise upgrade or
mise prune, don't render the [env] template, so they failed to parse
the Go version of every opencloud checkout:

mise WARN  error loading tracked config file .../mise.toml: invalid version for go in .../mise.toml: {{ env.GO_VERSION }} rendered to "{{ exec(command='./.mise-go-version.sh') }}": invalid tool version "{{ exec(command='./.mise-go-version.sh') }}": contains forbidden character '\''

As a result, mise prune also didn't see which Go version the checkouts
need.

How to test

  • mise ls --current shows go 1.26.0 with go.mod as its source
  • mise exec -- go version prints go1.26.0
  • from another directory, e.g. ~: mise prune --dry-run shows no
    "error loading tracked config file" warning for this checkout, and lists
    go 1.26.0 as required by its go.mod

AI assistance: Claude Code (claude-opus-5-5) found the mise setting,
wrote the change and this description, and ran the checks above.

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
@pbleser-oc pbleser-oc added Type:Maintenance E.g. technical debt, packaging, etc. Status:Needs-Review labels Nov 19, 2026
@pbleser-oc pbleser-oc self-assigned this Nov 19, 2026
@pbleser-oc
pbleser-oc requested a review from fschade November 19, 2026 23:26
@codacy-production

codacy-production Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage ∅ diff coverage · +0.01% coverage variation

Metric Results
Coverage variation ✅ +0.01% coverage variation (-1.00%)
Diff coverage ✅ ∅ diff coverage

View coverage diff in Codacy

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 fschade 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.

🤩 is that a new setting?

@pbleser-oc

Copy link
Copy Markdown
Member Author

@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 mise upgrade.

@pbleser-oc
pbleser-oc merged commit e095910 into opencloud-eu:main Nov 20, 2026
63 checks passed
@pbleser-oc
pbleser-oc deleted the chore/mise-go-version-from-go-mod branch November 20, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type:Maintenance E.g. technical debt, packaging, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants