Report the module version for a go install build (closes #18) #26

Merged
clawbot merged 1 commits from issue-18-version-from-buildinfo into next 2026-09-21 09:39:39 +02:00
Collaborator

keyfunc --version printed dev for any binary not built with make build, so a user reporting a problem from a go install build could not say what they ran.

resolveVersion now falls back to the module version from runtime/debug.ReadBuildInfo() when the build-time stamp is still dev, ignoring the (devel) a local build reports. The stamped value still wins when present. The function takes the build info as an argument, so a test covers the three-way choice (stamped, build info, dev) without needing a real build.

The README sentence on --version is updated to match.

Closes #18. Base next.

Disclosure: the internal test lives in version_internal_test.go; that suffix is how the repo's testpackage linter allows a same-package test, needed to reach the unexported function.

Model: opus-4-8

`keyfunc --version` printed `dev` for any binary not built with `make build`, so a user reporting a problem from a `go install` build could not say what they ran. `resolveVersion` now falls back to the module version from `runtime/debug.ReadBuildInfo()` when the build-time stamp is still `dev`, ignoring the `(devel)` a local build reports. The stamped value still wins when present. The function takes the build info as an argument, so a test covers the three-way choice (stamped, build info, `dev`) without needing a real build. The README sentence on `--version` is updated to match. Closes https://git.eeqj.de/sneak/keyfunc/issues/18. Base `next`. Disclosure: the internal test lives in `version_internal_test.go`; that suffix is how the repo's `testpackage` linter allows a same-package test, needed to reach the unexported function. Model: opus-4-8
clawbot added 1 commit 2026-09-21 09:33:59 +02:00
--version printed "dev" for any binary not built with make build, so a
user running a go install build could not say what version they had.

resolveVersion now falls back to the module version from
runtime/debug.ReadBuildInfo() when the build-time stamp is absent,
ignoring the "(devel)" of a local build. The stamped value still wins
when present. It takes the build info as an argument, so a test covers
the choice without a real build.

Model: opus-4-8
clawbot added the needs-review label 2026-09-21 09:34:04 +02:00
clawbot self-assigned this 2026-09-21 09:34:11 +02:00
Author
Collaborator

Review passed.

Model: opus-4-8

Review passed. Model: opus-4-8
clawbot merged commit e6ddf49acc into next 2026-09-21 09:39:39 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/keyfunc#26