Repository navigation
Description
Problem
internal/app/buildinfo.go is the intended version source, but release work currently requires changing that value and 67 literal 3.0.x values embedded in JSON-envelope tests. The v3.0.1 release demonstrated the cost: the version bump was mechanically safe only after a broad replacement and independent review.
GoReleaser already injects the release-tag version into internal/app.Version through linker flags. Direct Go installs also carry module build information that can identify the installed tag. Source code does not need to impersonate the latest release, but direct Go installs must remain a first-class, identifiable distribution path.
Design
Adopt a GogCLI-style version-resolution contract. dev is a final fallback, not the expected value for all non-GoReleaser builds.
Resolve the reported version in this order:
- Explicit linker-injected version: official GoReleaser archives report the immutable release version, for example
3.0.2. - Go module build information: a direct install such as
go install github.com/KalebCole/partiful-cli/cmd/[email protected]reports3.0.2fromruntime/debug.ReadBuildInfo(). - Project-local build metadata: the repository’s supported local build command injects
git describe --tags --always --dirty, so a checkout can report an informative revision such asv3.0.2-4-gabc1234-dirty. - Final fallback: a raw build with no injected or embedded metadata reports
dev.
Normalize the display form so existing Partiful releases retain their current no-leading-v convention (3.0.2, not v3.0.2).
Test fixtures derive data.version and meta.cliVersion from the same in-process resolved version value rather than repeating a literal version throughout JSON expectations. The source tree must never require a global string replacement for a normal patch release.
Do not change product contract revisions as part of this issue.
Implementation outline
- Add a focused version-resolution helper around the existing
internal/app.Versionvariable andruntime/debug.ReadBuildInfo(). - Preserve a sentinel source default such as
dev; use it only when no linker value, module version, or local-build metadata exists. - Add a supported local build command or script that passes
git describe --tags --always --dirtythrough linker flags without changing release behavior. - Keep GoReleaser's existing
-X github.com/KalebCole/partiful-cli/internal/app.Version={{ .Version }}release injection. - Introduce small test helpers for constructing version-bearing response metadata and replace literal version fragments in
internal/app/execute_test.goandinternal/app/guests_execute_test.go. - Update README install guidance for pinned tagged Go installs,
@latest, source builds, and release archives.
Acceptance criteria
- A release-style build with linker-injected
3.0.2reports3.0.2in bothdata.versionandmeta.cliVersion. - A build with Go module information for
v3.0.2reports normalized3.0.2without a GoReleaser linker injection. - A project-local build through the supported command reports a
git describeversion rather than a baredevvalue when Git metadata is available. - A raw build with no known build metadata reports
dev. - Version-bearing tests derive their expected value from one test/runtime source, not a repeated literal release number.
- A future patch release does not require updating JSON snapshots across unrelated command tests.
-
go mod verify,go test ./...,go test -race ./...,go vet ./...,go build ./..., and./scripts/verify-native-release.shpass. - No release tag, GitHub Release, or public artifact is created by this issue.
Dependency
This is the prerequisite for the SVU release automation issue. It removes the need for release automation to rewrite many test fixtures or open a version-only PR while preserving meaningful version output for users who install with Go.
Activity
KalebCole commentedon Nov 14, 2026
Triage bot: fits the Go-only release path, no hold. Version stays single-source in
internal/app/buildinfo.gowith GoReleaser ldflags.