Skip to content

version: fall back to debug.ReadBuildInfo() so 'go install' builds report their real version #36

Description

@timimsms

Context

go install github.com/timimsms/cu/cmd/cu@latest now works (verified post-v0.1.0) but the resulting binary reports cu version devgo 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions