Skip to content

fix: show real version from Go module build info#45

Merged
y0s3ph merged 1 commit into
mainfrom
fix/version-info
Mar 10, 2026
Merged

fix: show real version from Go module build info#45
y0s3ph merged 1 commit into
mainfrom
fix/version-info

Conversation

@y0s3ph

@y0s3ph y0s3ph commented Mar 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replaces hardcoded version = "dev" with debug.ReadBuildInfo() to read the module version injected by Go at build time
  • When installed via go install github.com/y0s3ph/gostrap/cmd/gostrap@v0.3.0, reports v0.3.0 instead of dev
  • Falls back to dev for local builds without module version info

Before

$ gostrap --version
gostrap version dev

After

$ go install github.com/y0s3ph/gostrap/cmd/gostrap@v0.3.0
$ gostrap --version
gostrap version v0.3.0

Test plan

  • go test -race ./internal/cli/ — passes
  • golangci-lint run — 0 issues
  • Local build shows pseudo-version (expected)
  • go install @tag will show the tagged version

Use debug.ReadBuildInfo() to read the module version injected by Go
at build time. When installed via go install ...@v0.3.0, gostrap
now correctly reports that version instead of hardcoded "dev".

Falls back to "dev" for local builds without version info.
@y0s3ph y0s3ph self-assigned this Mar 10, 2026
@y0s3ph y0s3ph merged commit e35f5a7 into main Mar 10, 2026
3 checks passed
@y0s3ph y0s3ph deleted the fix/version-info branch March 10, 2026 12:44
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.

1 participant