Skip to content

Commit 6857b36

Browse files
committed
fix(cli): inject version into Go binary via ldflags
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
1 parent e123b51 commit 6857b36

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

apps/cli/scripts/build.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ async function buildGoTarget(target: (typeof TARGETS)[number]) {
125125
const outfile = path.join(binDir, `supabase-go${target.ext}`);
126126

127127
console.log(`[${target.pkg}] Compiling Go CLI (${goos}/${goarch})...`);
128-
await $`go build -trimpath -ldflags="-s -w" -o ${outfile} .`.cwd(goSource).env({
128+
const goLdflags = `-s -w -X github.com/supabase/cli/internal/utils.Version=${version}`;
129+
await $`go build -trimpath -ldflags=${goLdflags} -o ${outfile} .`.cwd(goSource).env({
129130
...process.env,
130131
GOOS: goos,
131132
GOARCH: goarch,

0 commit comments

Comments
 (0)