No version surface in the binary: embed the commit hash and expose it #47

Open
opened 2026-08-10 15:51:59 +02:00 by clawbot · 0 comments
Collaborator

Deliberately excluded from #19, which added make build, so it is filed here rather than lost.

The org Go styleguide wants the git commit hash embedded at build time (-X main.Version) and surfaced at startup. This repo has no version surface at all, so it is more than a linker flag.

Definition of done

  • A main.Version variable set via -ldflags -X from make build.
  • A decision, recorded in the code, on where it surfaces. The candidates are a startup line, a -v flag, and the score screen — but this is a faithful port of Rogue 5.4.4, so anything that changes what the player sees during a normal game is a divergence from C and needs justifying as one. A -v flag that exits immediately is the least invasive and is the presumed answer unless someone argues otherwise.
  • A sane fallback when the tree is dirty or there is no VCS (a plain go build with no ldflags must still produce a runnable binary, not an empty version string that reads as a bug).
  • make check green; TODO.md Completed Steps entry in the same commit; commit title ends (closes #N).

Priority

Low. No defect behind it, and it must not alter in-game display without a deliberate decision.

Deliberately excluded from https://git.eeqj.de/sneak/rgoue/issues/19, which added `make build`, so it is filed here rather than lost. The org Go styleguide wants the git commit hash embedded at build time (`-X main.Version`) and surfaced at startup. This repo has no version surface at all, so it is more than a linker flag. ## Definition of done - A `main.Version` variable set via `-ldflags -X` from `make build`. - A decision, recorded in the code, on where it surfaces. The candidates are a startup line, a `-v` flag, and the score screen — but this is a faithful port of Rogue 5.4.4, so anything that changes what the player sees during a normal game is a divergence from C and needs justifying as one. A `-v` flag that exits immediately is the least invasive and is the presumed answer unless someone argues otherwise. - A sane fallback when the tree is dirty or there is no VCS (a plain `go build` with no ldflags must still produce a runnable binary, not an empty version string that reads as a bug). - `make check` green; `TODO.md` Completed Steps entry in the same commit; commit title ends ` (closes #N)`. ## Priority Low. No defect behind it, and it must not alter in-game display without a deliberate decision.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/rgoue#47