From 6857b3644da2b0e9ba39df7f882f3ff586fc5a82 Mon Sep 17 00:00:00 2001 From: Colum Ferry Date: Wed, 20 May 2026 11:10:45 +0100 Subject: [PATCH] fix(cli): inject version into Go binary via ldflags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The legacy CLI shell forwards most commands to the bundled `supabase-go` binary, whose upgrade banner reports the currently installed version from `utils.Version` — a string assigned via `-ldflags -X` at compile time. The Bun build script was missing that injection, so every release shipped a Go binary with `utils.Version=""`, producing: A new version of Supabase CLI is available: v2.100.1 (currently installed v) and triggering the upgrade prompt on every invocation (semver.Compare treats the empty string as less than any valid version). Restore the `-X github.com/supabase/cli/internal/utils.Version=...` ldflag in `apps/cli/scripts/build.ts` so the npm version is baked into the Go binary at build time, matching the prior `.goreleaser.yml` behavior. Fixes #5308 --- apps/cli/scripts/build.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/cli/scripts/build.ts b/apps/cli/scripts/build.ts index 3bf46f4a3..524cae04b 100644 --- a/apps/cli/scripts/build.ts +++ b/apps/cli/scripts/build.ts @@ -125,7 +125,8 @@ async function buildGoTarget(target: (typeof TARGETS)[number]) { const outfile = path.join(binDir, `supabase-go${target.ext}`); console.log(`[${target.pkg}] Compiling Go CLI (${goos}/${goarch})...`); - await $`go build -trimpath -ldflags="-s -w" -o ${outfile} .`.cwd(goSource).env({ + const goLdflags = `-s -w -X github.com/supabase/cli/internal/utils.Version=${version}`; + await $`go build -trimpath -ldflags=${goLdflags} -o ${outfile} .`.cwd(goSource).env({ ...process.env, GOOS: goos, GOARCH: goarch,