-
Notifications
You must be signed in to change notification settings - Fork 0
version: fall back to debug.ReadBuildInfo() so 'go install' builds report their real version #36
Open
Description
Context
go install github.com/timimsms/cu/cmd/cu@latest now works (verified post-v0.1.0) but the resulting binary reports cu version dev — go install doesn't apply the ldflags that Make/GoReleaser set.
Suggested fix
In internal/version, when Version == "dev", fall back to runtime/debug.ReadBuildInfo(): info.Main.Version carries the module version (v0.1.0) for go install builds, and the vcs.revision/vcs.time build settings cover commit/date. This is the same pattern gh and other Go CLIs use, and it keeps ldflags as the primary source for released binaries.