Skip to content

fix(cli): fall back to module version when ldflags is absent - #7

Merged
antonysastre merged 1 commit into
mainfrom
fix/go-install-version
May 16, 2026
Merged

antonysastre merged 1 commit into
mainfrom
fix/go-install-version

Conversation

@antonysastre

Copy link
Copy Markdown
Owner

Summary

`go install github.com/antonysastre/sheets/cmd/she@latest` (the README's "From source" path) bypasses our Makefile, so the resulting binary reports `she dev` instead of a real version. `versionString` now falls back to `runtime/debug.ReadBuildInfo` when the ldflags-injected value is the `dev` sentinel, returning the module version baked in by `go install`.

Discovered while verifying README claims against actual behavior — every other documented behavior (sheet format rules, all CLI flags, curl-bash installer, goreleaser dry-run, GitHub Actions release workflow) checks out.

Test plan

  • `make build && ./she --version` still reports the ldflags-injected `git describe` version (unchanged behavior)
  • `go build -o ./cmd/she` (simulating no-ldflags install) reports the module pseudo-version (`v0.1.1-0.20260516xxx-xxxxx+dirty`) instead of `she dev`
  • `TestVersionString` locks in the ldflags-wins path and the `(devel)`/empty rejection
  • All existing tests pass
  • After this lands, tag a new release so `go install ...@latest` picks it up; verify the released binary reports `v0.1.1` (or whatever) instead of `she dev`

go install github.com/antonysastre/sheets/cmd/she@latest bypasses our
Makefile and produces a binary with version="dev", so users following
the README's "From source" path see an uninformative version string.
versionString now consults runtime/debug.ReadBuildInfo when the
ldflags-injected value is the dev sentinel, returning the module
version baked in by go install. Local make build is unaffected.
@antonysastre
antonysastre merged commit d8b3999 into main May 16, 2026
2 checks passed
@antonysastre
antonysastre deleted the fix/go-install-version branch May 16, 2026 03:27
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