Skip to content

Fall back to Go module build info when version isn't set via ldflags#443

Open
stickpro wants to merge 1 commit into
mailru:masterfrom
stickpro:issue-438
Open

Fall back to Go module build info when version isn't set via ldflags#443
stickpro wants to merge 1 commit into
mailru:masterfrom
stickpro:issue-438

Conversation

@stickpro

Copy link
Copy Markdown
Contributor

Summary

  • Version/Commit (added in feat: Add version and commit information to easyjson generator #424) are only populated via -ldflags at release build time (see Makefile). go install github.com/mailru/easyjson/easyjson@v0.9.2 doesn't pass those flags, so the installed binary always reports version: dev / commit: none.
  • versionInfo() now falls back to runtime/debug.ReadBuildInfo() when Version/Commit are left at their defaults, picking up the module version and VCS revision that the Go toolchain embeds automatically for both go install pkg@version and local go build in a git checkout. ldflags-set values (used by the release Makefile) still take priority.

Closes #438

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recommended install creates a binary without version&comment flags

1 participant