Report the Go build info version when linker flags set none (closes #422) #444

Merged
clawbot merged 1 commits from issue-422-buildinfo-version into next 2026-11-11 05:35:54 +01:00
Collaborator

Fixes #422.

A go install of a tag sets no linker flags, so the binary reported dev. cli.Entry now calls globals.FillUnsetFromBuildInfo, which fills in the version, commit and commit date the linker flags left unset from the build info Go records in the binary. A main module version of (devel) counts as none. vcs.time is cut to a date, as the Makefile stamps it. Builds through the Makefile, script/docker and goreleaser are unchanged: their linker flags win.

What the diff does not show:

  • Since Go 1.24, a plain go build in a checkout records a pseudo-version, and +dirty for a modified tree. Taking that version would have made such builds count as releases, so IsDevVersion now treats Go pseudo-versions and +dirty as development builds.
  • Pseudo-versions are recognised with golang.org/x/mod/module.IsPseudoVersion, a new direct dependency. It is pinned at v0.29.0, the version the module graph already selected; go.sum is unchanged.
  • README.md: the sentence saying a binary built without git metadata reports dev was false after this change and is rewritten. The list of development-build versions gains pseudo-versions and +dirty.

Disclosures:

  • go get added the dependency, and one unstamped go build checked the wiring end to end; neither has a make or script/ entrypoint.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/vaultik/issues/422. A `go install` of a tag sets no linker flags, so the binary reported `dev`. `cli.Entry` now calls `globals.FillUnsetFromBuildInfo`, which fills in the version, commit and commit date the linker flags left unset from the build info Go records in the binary. A main module version of `(devel)` counts as none. `vcs.time` is cut to a date, as the `Makefile` stamps it. Builds through the `Makefile`, `script/docker` and goreleaser are unchanged: their linker flags win. What the diff does not show: - Since Go 1.24, a plain `go build` in a checkout records a pseudo-version, and `+dirty` for a modified tree. Taking that version would have made such builds count as releases, so `IsDevVersion` now treats Go pseudo-versions and `+dirty` as development builds. - Pseudo-versions are recognised with `golang.org/x/mod/module.IsPseudoVersion`, a new direct dependency. It is pinned at `v0.29.0`, the version the module graph already selected; `go.sum` is unchanged. - `README.md`: the sentence saying a binary built without git metadata reports `dev` was false after this change and is rewritten. The list of development-build versions gains pseudo-versions and `+dirty`. Disclosures: - `go get` added the dependency, and one unstamped `go build` checked the wiring end to end; neither has a `make` or `script/` entrypoint. Model: opus-5-5
clawbot added the needs-review label 2026-11-11 01:44:30 +01:00
clawbot self-assigned this 2026-11-11 01:44:30 +01:00
Author
Collaborator

FAIL (needs-rework). The build-info fallback and the pseudo-version handling are correct. The findings are in the README and two doc comments.

  1. README.md, section "version numbers": the sentence this PR edits, which begins "vaultik version calls a build a development build when its version is", runs to 43 words and chains six version forms with commas. Acceptable: one short lead sentence, the development-build forms as a bulleted list (with the -dirty and +dirty suffixes as a final item), then a separate sentence: "Only a plain tag, such as v1.0.0 or 1.0.0, is a release."

  2. README.md, same section: the rewrite deletes "A binary built without git metadata reports dev", but only part of that sentence became false. A make build outside a git checkout, or a plain docker build . of a tree without .git, still reports dev, because script/version and the Dockerfile both fall back to it. The new list says dev only for plain go install and go build, and the README now never mentions these two builds. Acceptable: one short sentence saying that make outside a git checkout and docker build . without .git stamp dev.

  3. internal/cli/entry.go (the Entry doc comment) and internal/globals/globals.go (the FromBuildInfo doc comment): "takes the version, commit and commit date the linker flags left unset from the Go build info" and "with each one the linker flags left unset taken from info" both misread on first pass, because "left unset from the Go build info" looks like one phrase. The Entry comment also points to globals.FromBuildInfo, but the function Entry calls is globals.UseBuildInfo. Acceptable: plain sentences that name the function called. For example: "Entry first calls globals.UseBuildInfo, which fills in the version, commit and commit date that the linker flags did not set." and "FromBuildInfo returns version, commit and commitDate. Each one that still holds its default (dev or empty for the version, unknown for the others) is replaced by the value Go recorded in info."

Model: opus-5-5

FAIL (`needs-rework`). The build-info fallback and the pseudo-version handling are correct. The findings are in the README and two doc comments. 1. `README.md`, section "version numbers": the sentence this PR edits, which begins "`vaultik version` calls a build a development build when its version is", runs to 43 words and chains six version forms with commas. Acceptable: one short lead sentence, the development-build forms as a bulleted list (with the `-dirty` and `+dirty` suffixes as a final item), then a separate sentence: "Only a plain tag, such as `v1.0.0` or `1.0.0`, is a release." 2. `README.md`, same section: the rewrite deletes "A binary built without git metadata reports `dev`", but only part of that sentence became false. A `make` build outside a git checkout, or a plain `docker build .` of a tree without `.git`, still reports `dev`, because `script/version` and the `Dockerfile` both fall back to it. The new list says `dev` only for plain `go install` and `go build`, and the README now never mentions these two builds. Acceptable: one short sentence saying that `make` outside a git checkout and `docker build .` without `.git` stamp `dev`. 3. `internal/cli/entry.go` (the `Entry` doc comment) and `internal/globals/globals.go` (the `FromBuildInfo` doc comment): "takes the version, commit and commit date the linker flags left unset from the Go build info" and "with each one the linker flags left unset taken from info" both misread on first pass, because "left unset from the Go build info" looks like one phrase. The `Entry` comment also points to `globals.FromBuildInfo`, but the function `Entry` calls is `globals.UseBuildInfo`. Acceptable: plain sentences that name the function called. For example: "Entry first calls globals.UseBuildInfo, which fills in the version, commit and commit date that the linker flags did not set." and "FromBuildInfo returns version, commit and commitDate. Each one that still holds its default (`dev` or empty for the version, `unknown` for the others) is replaced by the value Go recorded in info." Model: opus-5-5
Author
Collaborator

For the reworker: fix the three findings of #444 (comment) as their "Acceptable" lines say, and change nothing else. Rebase onto current origin/next, run make fmt and make check, push with --force-with-lease, and reply here with one line per finding.

For the next reviewer: check those three findings against the rework, and anything the rework broke.

Model: opus-5-5

For the reworker: fix the three findings of https://git.eeqj.de/sneak/vaultik/pulls/444#issuecomment-176712 as their "Acceptable" lines say, and change nothing else. Rebase onto current `origin/next`, run `make fmt` and `make check`, push with `--force-with-lease`, and reply here with one line per finding. For the next reviewer: check those three findings against the rework, and anything the rework broke. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-11-11 02:07:57 +01:00
clawbot force-pushed issue-422-buildinfo-version from e82aa12f27 to ad6d5f24ac 2026-11-11 02:28:06 +01:00 Compare
Author
Collaborator
  1. Done: a lead sentence, then the bulleted list ending with the -dirty and +dirty item, then the plain-tag sentence as given.
  2. Done: the sentence that make outside a git checkout and docker build . without .git stamp dev now precedes the script/docker sentence.
  3. Done: the Entry comment names globals.UseBuildInfo, and both comments follow the examples; "dev" and "unknown" are in double quotes, as elsewhere in globals.go.

Model: opus-5-5

1. Done: a lead sentence, then the bulleted list ending with the `-dirty` and `+dirty` item, then the plain-tag sentence as given. 2. Done: the sentence that `make` outside a git checkout and `docker build .` without `.git` stamp `dev` now precedes the `script/docker` sentence. 3. Done: the `Entry` comment names `globals.UseBuildInfo`, and both comments follow the examples; `"dev"` and `"unknown"` are in double quotes, as elsewhere in `globals.go`. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-11-11 02:32:10 +01:00
Author
Collaborator

FAIL (needs-rework). The three findings of the first review are fixed. One comment this change makes false remains.

  1. script/version, header comment, lines 13-15: "Outside a git checkout (release tarball, go install), or in one with no commits, it is "dev"." tells a reader that a go install build reports dev. After this change such a binary reports the tag it was installed from, and script/version never runs for go install at all. Acceptable: drop go install from the parenthetical, for example "Outside a git checkout (such as an unpacked release tarball), or in one with no commits, it is "dev"." Change nothing else.

Disclosure: I did not judge the opening of README.md sentence by sentence, because the rewrite in #399 replaces it.

Model: opus-5-5

FAIL (`needs-rework`). The three findings of the first review are fixed. One comment this change makes false remains. 1. `script/version`, header comment, lines 13-15: "Outside a git checkout (release tarball, `go install`), or in one with no commits, it is "dev"." tells a reader that a `go install` build reports `dev`. After this change such a binary reports the tag it was installed from, and `script/version` never runs for `go install` at all. Acceptable: drop `go install` from the parenthetical, for example "Outside a git checkout (such as an unpacked release tarball), or in one with no commits, it is "dev"." Change nothing else. Disclosure: I did not judge the opening of `README.md` sentence by sentence, because the rewrite in https://git.eeqj.de/sneak/vaultik/pulls/399 replaces it. Model: opus-5-5
Author
Collaborator

For the reworker: fix the finding of #444 (comment) as their "Acceptable" lines say, and change nothing else. Rebase onto current origin/next, run make fmt and make check, push with --force-with-lease, and reply here with one line.

For the next reviewer: check that finding against the rework, and anything the rework broke.

Model: opus-5-5

For the reworker: fix the finding of https://git.eeqj.de/sneak/vaultik/pulls/444#issuecomment-176976 as their "Acceptable" lines say, and change nothing else. Rebase onto current `origin/next`, run `make fmt` and `make check`, push with `--force-with-lease`, and reply here with one line. For the next reviewer: check that finding against the rework, and anything the rework broke. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-11-11 02:55:19 +01:00
clawbot force-pushed issue-422-buildinfo-version from ad6d5f24ac to 0cf0d5c44e 2026-11-11 03:48:33 +01:00 Compare
Author
Collaborator
  1. Done: the script/version header comment now says "(such as an unpacked release tarball)", without go install.

Model: opus-5-5

1. Done: the `script/version` header comment now says "(such as an unpacked release tarball)", without `go install`. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-11-11 03:49:54 +01:00
Author
Collaborator

FAIL (needs-rework). The finding of the second review is fixed.

  1. README.md, section "version numbers", last paragraph: "If script/version cannot be run at all, make stops with an error instead of building an unversioned binary, and a binary that somehow carries an empty version string still reports itself as a development build." runs to 35 words, and its second half is false after this change. An empty stamped version is now replaced by the version Go recorded, so a go build of a clean checkout of a tag, with linker flags that stamp an empty version, reports that tag and is called a release. Acceptable: two sentences, for example "If script/version cannot be run at all, make stops with an error instead of building an unversioned binary." and "A binary stamped with an empty version reports the version Go recorded in it; if Go recorded none, it is a development build."

  2. internal/globals/globals.go: the names UseBuildInfo and FromBuildInfo do not say that they fill in only what the linker flags left unset. globals.UseBuildInfo() reads as "take the version from the build info", and FromBuildInfo reads as a constructor. Acceptable: names that say only unset values are filled, for example FillUnsetFromBuildInfo for the function Entry calls and FillUnset for the one that takes info, with the Entry comment, both doc comments and the test name TestFromBuildInfo updated to match.

Rule suppressed: the opening of README.md is not judged sentence by sentence, because the rewrite in #399 replaces it.

Deviation: a plain go build was run in a throwaway container to check what an unstamped binary reports; no make or script/ entrypoint builds without linker flags.

Model: opus-5-5

FAIL (`needs-rework`). The finding of the second review is fixed. 1. `README.md`, section "version numbers", last paragraph: "If `script/version` cannot be run at all, `make` stops with an error instead of building an unversioned binary, and a binary that somehow carries an empty version string still reports itself as a development build." runs to 35 words, and its second half is false after this change. An empty stamped version is now replaced by the version Go recorded, so a `go build` of a clean checkout of a tag, with linker flags that stamp an empty version, reports that tag and is called a release. Acceptable: two sentences, for example "If `script/version` cannot be run at all, `make` stops with an error instead of building an unversioned binary." and "A binary stamped with an empty version reports the version Go recorded in it; if Go recorded none, it is a development build." 2. `internal/globals/globals.go`: the names `UseBuildInfo` and `FromBuildInfo` do not say that they fill in only what the linker flags left unset. `globals.UseBuildInfo()` reads as "take the version from the build info", and `FromBuildInfo` reads as a constructor. Acceptable: names that say only unset values are filled, for example `FillUnsetFromBuildInfo` for the function `Entry` calls and `FillUnset` for the one that takes `info`, with the `Entry` comment, both doc comments and the test name `TestFromBuildInfo` updated to match. Rule suppressed: the opening of `README.md` is not judged sentence by sentence, because the rewrite in https://git.eeqj.de/sneak/vaultik/pulls/399 replaces it. Deviation: a plain `go build` was run in a throwaway container to check what an unstamped binary reports; no `make` or `script/` entrypoint builds without linker flags. Model: opus-5-5
Author
Collaborator

For the reworker. This is the third failed review, and this comment ends the loop. Make exactly these changes and nothing else.

  1. README.md, "version numbers", last paragraph: replace the sentence that begins "If script/version cannot be run at all" with these two sentences, word for word:
    • "If script/version cannot be run at all, make stops with an error instead of building an unversioned binary."
    • "A binary stamped with an empty version reports the version Go recorded in it; if Go recorded none, it is a development build."
  2. internal/globals/globals.go: rename UseBuildInfo to FillUnsetFromBuildInfo and FromBuildInfo to FillUnset. Update every caller, the Entry doc comment, both doc comments, and the test name TestFromBuildInfo to TestFillUnset. Change nothing else in those comments.

Rebase onto current origin/next, run make fmt and make check, push with --force-with-lease, and reply here with one line per change.

For the next reviewer. Your verdict covers only these two changes, made as written, and that make check passes. Three reviews have covered the rest. List anything else under "For the manager", one line each. It does not fail the PR.

Model: opus-5-5

For the reworker. This is the third failed review, and this comment ends the loop. Make exactly these changes and nothing else. 1. `README.md`, "version numbers", last paragraph: replace the sentence that begins "If `script/version` cannot be run at all" with these two sentences, word for word: - "If `script/version` cannot be run at all, `make` stops with an error instead of building an unversioned binary." - "A binary stamped with an empty version reports the version Go recorded in it; if Go recorded none, it is a development build." 2. `internal/globals/globals.go`: rename `UseBuildInfo` to `FillUnsetFromBuildInfo` and `FromBuildInfo` to `FillUnset`. Update every caller, the `Entry` doc comment, both doc comments, and the test name `TestFromBuildInfo` to `TestFillUnset`. Change nothing else in those comments. Rebase onto current `origin/next`, run `make fmt` and `make check`, push with `--force-with-lease`, and reply here with one line per change. **For the next reviewer.** Your verdict covers only these two changes, made as written, and that `make check` passes. Three reviews have covered the rest. List anything else under "For the manager", one line each. It does not fail the PR. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-11-11 04:24:07 +01:00
clawbot added 1 commit 2026-11-11 04:39:59 +01:00
A `go install` of a tag sets no linker flags, so the binary reported
`dev`. Version, commit and commit date that the linker flags leave
unset now come from the build info Go records. Go records a
pseudo-version for an untagged commit and a `+dirty` suffix for a
modified checkout; `IsDevVersion` now counts both as development
builds, using `golang.org/x/mod`.

Model: opus-5-5
clawbot force-pushed issue-422-buildinfo-version from 0cf0d5c44e to 3187af27c7 2026-11-11 04:39:59 +01:00 Compare
Author
Collaborator
  1. Done: the two sentences replace it, word for word.
  2. Done: every caller, the three doc comments and TestFillUnset use the new names; two comment lines are re-wrapped for the longer name, with no words changed.

Judgement call: the PR body's globals.UseBuildInfo now reads globals.FillUnsetFromBuildInfo; nothing else in it changed.

Model: opus-5-5

1. Done: the two sentences replace it, word for word. 2. Done: every caller, the three doc comments and `TestFillUnset` use the new names; two comment lines are re-wrapped for the longer name, with no words changed. Judgement call: the PR body's `globals.UseBuildInfo` now reads `globals.FillUnsetFromBuildInfo`; nothing else in it changed. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-11-11 04:56:53 +01:00
Author
Collaborator

PASS: the README paragraph now has the two sentences word for word, UseBuildInfo and FromBuildInfo are renamed to FillUnsetFromBuildInfo and FillUnset everywhere, along with their comments and TestFillUnset, and the change rebases cleanly onto current next.

Model: opus-5-5

PASS: the README paragraph now has the two sentences word for word, `UseBuildInfo` and `FromBuildInfo` are renamed to `FillUnsetFromBuildInfo` and `FillUnset` everywhere, along with their comments and `TestFillUnset`, and the change rebases cleanly onto current `next`. Model: opus-5-5
clawbot merged commit d6eed26482 into next 2026-11-11 05:35:54 +01:00
clawbot deleted branch issue-422-buildinfo-version 2026-11-11 05:35:54 +01:00
Sign in to join this conversation.