From f0cdcb853dfb27db272afd3fc09820fbe352490c Mon Sep 17 00:00:00 2001 From: Patrick Dawkins Date: Wed, 11 Mar 2026 15:47:02 +0000 Subject: [PATCH] fix: restore version ldflag for GoReleaser builds Commit 73a97c77 removed the version ldflag in favor of runtime/debug.ReadBuildInfo(). However, Go's build info only reports the correct version when the module path matches the tag's major version. Since the module is github.com/upsun/cli (no /v5 suffix) but tags are v5.x.x, Go returns a pseudo-version instead. Restore the -X ldflag to inject the version from the tag at build time. The debug.ReadBuildInfo() fallback remains for go install users (where ldflags are not set). Co-Authored-By: Claude Opus 4.6 (1M context) --- .goreleaser.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index e6a645c9..9898b379 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -25,6 +25,7 @@ builds: - platformsh ldflags: - -s -w + - -X "github.com/upsun/cli/internal/config.Version={{.Version}}" - -X "github.com/upsun/cli/internal/legacy.PHPVersion={{.Env.PHP_VERSION}}" main: ./cmd/platform - binary: platform @@ -40,6 +41,7 @@ builds: - platformsh ldflags: - -s -w + - -X "github.com/upsun/cli/internal/config.Version={{.Version}}" - -X "github.com/upsun/cli/internal/legacy.PHPVersion={{.Env.PHP_VERSION}}" main: ./cmd/platform @@ -58,6 +60,7 @@ builds: goarch: arm64 ldflags: - -s -w + - -X "github.com/upsun/cli/internal/config.Version={{.Version}}" - -X "github.com/upsun/cli/internal/legacy.PHPVersion={{.Env.PHP_VERSION}}" main: ./cmd/platform - binary: upsun @@ -71,6 +74,7 @@ builds: - arm64 ldflags: - -s -w + - -X "github.com/upsun/cli/internal/config.Version={{.Version}}" - -X "github.com/upsun/cli/internal/legacy.PHPVersion={{.Env.PHP_VERSION}}" main: ./cmd/platform