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.
Plan. Ruling on where the version shows: a -v flag that prints it to stdout and exits 0, before the terminal is touched. Nothing changes in what the player sees during a game, so there is no departure from C.
make build sets main.Version with -ldflags "-X main.Version=..." from git rev-parse --short HEAD, with -dirty appended when the tree has uncommitted changes.
Fallback when main.Version was not set at link time (a plain build without the flag): use vcs.revision (and vcs.modified) from runtime/debug.ReadBuildInfo, and failing that a fixed word such as unknown. Never an empty string.
A test covers the fallback order. README.md documents -v next to -s and -d.
Runs after #25 (same file, cmd/rogue/main.go) and #42 (same Makefile) land.
Model: opus-5-5
Plan. Ruling on where the version shows: a `-v` flag that prints it to stdout and exits 0, before the terminal is touched. Nothing changes in what the player sees during a game, so there is no departure from C.
- `make build` sets `main.Version` with `-ldflags "-X main.Version=..."` from `git rev-parse --short HEAD`, with `-dirty` appended when the tree has uncommitted changes.
- Fallback when `main.Version` was not set at link time (a plain build without the flag): use `vcs.revision` (and `vcs.modified`) from `runtime/debug.ReadBuildInfo`, and failing that a fixed word such as `unknown`. Never an empty string.
- A test covers the fallback order. `README.md` documents `-v` next to `-s` and `-d`.
- Runs after https://git.eeqj.de/sneak/rgoue/issues/25 (same file, `cmd/rogue/main.go`) and https://git.eeqj.de/sneak/rgoue/issues/42 (same `Makefile`) land.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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
main.Versionvariable set via-ldflags -Xfrommake build.-vflag, 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-vflag that exits immediately is the least invasive and is the presumed answer unless someone argues otherwise.go buildwith no ldflags must still produce a runnable binary, not an empty version string that reads as a bug).make checkgreen;TODO.mdCompleted 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.
Plan. Ruling on where the version shows: a
-vflag that prints it to stdout and exits 0, before the terminal is touched. Nothing changes in what the player sees during a game, so there is no departure from C.make buildsetsmain.Versionwith-ldflags "-X main.Version=..."fromgit rev-parse --short HEAD, with-dirtyappended when the tree has uncommitted changes.main.Versionwas not set at link time (a plain build without the flag): usevcs.revision(andvcs.modified) fromruntime/debug.ReadBuildInfo, and failing that a fixed word such asunknown. Never an empty string.README.mddocuments-vnext to-sand-d.cmd/rogue/main.go) and #42 (sameMakefile) land.Model: opus-5-5