From d662f01768878b29b0b5012a174e054d8ed6eb21 Mon Sep 17 00:00:00 2001 From: Pascal Bleser Date: Fri, 20 Nov 2026 00:17:17 +0100 Subject: [PATCH] chore(mise): take the Go version from go.mod natively 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 --- .mise-go-version.sh | 21 --------------------- mise.toml | 6 +++--- 2 files changed, 3 insertions(+), 24 deletions(-) delete mode 100755 .mise-go-version.sh diff --git a/.mise-go-version.sh b/.mise-go-version.sh deleted file mode 100755 index 3ea76554ed..0000000000 --- a/.mise-go-version.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -set -euo pipefail - -# Purpose of this script is to parse the go.mod file to retrieve the version of -# Go that we are using, either from a "toolchain" directive (preferred), or from -# a "go" directive as a fallback. -# -# The script then outputs that version, where it will be picked up as an environment -# variable in mise. - -F="./go.mod" - -AWK=awk -# prefer 'gawk' over 'awk' to make sure we get GNU awk -command -v gawk &>/dev/null && AWK=gawk - -[[ -e $F ]] || { echo "ERROR: failed to find $F" >&2; exit 1;} - -GO_VERSION=$("$AWK" '/^toolchain/ {print $2; exit} /^go / {print $2}' "$F") -GO_VERSION=${GO_VERSION#go} # strip the potential 'go' prefix: -echo "${GO_VERSION}" diff --git a/mise.toml b/mise.toml index 2cc6ebb761..67f7614ad2 100644 --- a/mise.toml +++ b/mise.toml @@ -1,8 +1,8 @@ -[env] -GO_VERSION = "{{ exec(command='./.mise-go-version.sh') }}" +[settings] +# take the Go version from go.mod (the toolchain directive, else the go directive) +idiomatic_version_file_enable_tools = ["go"] [tools] -go = "{{ env.GO_VERSION }}" node = "24" pnpm = "11.1.3" "go:github.com/go-delve/delve/cmd/dlv" = "1.27.1"