From 2f2ed7554b1464702934ccab6d85d69e57f260dc Mon Sep 17 00:00:00 2001 From: Cody Lee Date: Tue, 17 Feb 2026 12:36:14 -0600 Subject: [PATCH] fix(version): correct ldflags variable names for build metadata The ldflags in .goreleaser.yml and Makefile referenced non-existent variables (version.Commit, version.Date, version.BuiltBy), causing release binaries to show "unknown" for git commit and build date. Fixed to match the actual Go variables (version.GitCommit, version.BuildDate). Co-Authored-By: Claude Opus 4.6 (1M context) --- .goreleaser.yml | 5 ++--- Makefile | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 82649d06..486d8b89 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -33,9 +33,8 @@ builds: ldflags: - -s -w - -X github.com/DataDog/pup/internal/version.Version={{.Version}} - - -X github.com/DataDog/pup/internal/version.Commit={{.Commit}} - - -X github.com/DataDog/pup/internal/version.Date={{.Date}} - - -X github.com/DataDog/pup/internal/version.BuiltBy=goreleaser + - -X github.com/DataDog/pup/internal/version.GitCommit={{.Commit}} + - -X github.com/DataDog/pup/internal/version.BuildDate={{.Date}} archives: - id: pup diff --git a/Makefile b/Makefile index 099f56fb..4d87bf10 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,8 @@ DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ") # Build flags LDFLAGS := -s -w \ -X github.com/DataDog/pup/internal/version.Version=$(VERSION) \ - -X github.com/DataDog/pup/internal/version.Commit=$(COMMIT) \ - -X github.com/DataDog/pup/internal/version.Date=$(DATE) \ - -X github.com/DataDog/pup/internal/version.BuiltBy=makefile + -X github.com/DataDog/pup/internal/version.GitCommit=$(COMMIT) \ + -X github.com/DataDog/pup/internal/version.BuildDate=$(DATE) # Go build flags GO_BUILD_FLAGS := -trimpath -ldflags "$(LDFLAGS)"