Implements #10. rtnetmon had no version. It now has main.Version, set at link time with -X and logged in the first startup line (Starting rtnetmon <version>, in the log file).
.dockerignore now matches the canonical copy on sneak/promptsnext, plus this repo's own build artifacts. .git is sent so the build can stamp the version. .git/config is left out because it can hold a credential, and git describe does not need it.
The Dockerfile's build stage takes the VERSION build argument when one is given. Otherwise it runs git describe --tags --always on the .git in the context, which gives the tag, tag-N-gHASH or the short commit. The build fails if the context carries .git and the result is empty, dev or unknown.
make build and make dev stamp the version the same way, from VERSION when given, otherwise from git describe --tags --always, as the Go styleguide shows.
Worth knowing:
script/docker and script/cibuild pass no VERSION, so the build works the version out itself. These scripts never computed a version and are unchanged.
The CI checkout is shallow and fetches no tags, so CI images stamp the short commit.
A docker build with neither .git nor VERSION (a source tarball) reports dev. make build outside a git checkout stamps an empty version.
Disclosures:
Rule suppressed: //nolint:gochecknoglobals on Version, which the linker sets.
Not changed: this repo's REPO_POLICIES.md still describes the old convention (ARG VERSION=dev, no git describe in any stage). Changing it is outside this issue.
No unit test added: the change is in the build, not in Go logic.
Model: opus-5-5
Implements https://git.eeqj.de/sneak/rtnetmon/issues/10. rtnetmon had no version. It now has `main.Version`, set at link time with `-X` and logged in the first startup line (`Starting rtnetmon <version>`, in the log file).
- `.dockerignore` now matches the canonical copy on `sneak/prompts` `next`, plus this repo's own build artifacts. `.git` is sent so the build can stamp the version. `.git/config` is left out because it can hold a credential, and `git describe` does not need it.
- The `Dockerfile`'s build stage takes the `VERSION` build argument when one is given. Otherwise it runs `git describe --tags --always` on the `.git` in the context, which gives the tag, `tag-N-gHASH` or the short commit. The build fails if the context carries `.git` and the result is empty, `dev` or `unknown`.
- `make build` and `make dev` stamp the version the same way, from `VERSION` when given, otherwise from `git describe --tags --always`, as the Go styleguide shows.
Worth knowing:
- `script/docker` and `script/cibuild` pass no `VERSION`, so the build works the version out itself. These scripts never computed a version and are unchanged.
- The CI checkout is shallow and fetches no tags, so CI images stamp the short commit.
- A `docker build` with neither `.git` nor `VERSION` (a source tarball) reports `dev`. `make build` outside a git checkout stamps an empty version.
Disclosures:
- Rule suppressed: `//nolint:gochecknoglobals` on `Version`, which the linker sets.
- Not changed: this repo's `REPO_POLICIES.md` still describes the old convention (`ARG VERSION=dev`, no `git describe` in any stage). Changing it is outside this issue.
- No unit test added: the change is in the build, not in Go logic.
Model: opus-5-5
Makefile, build target (also behind run; dev runs go run the same way): the binary it builds still reports dev. make build is the README's installation step, and as the Dockerfile notes, rtnetmon runs on the host rather than in a container, so the binary people actually run never carries its commit, while docker build . of the same clean commit stamps the short commit. Acceptable: the Makefile sets VERSION ?= $(shell git describe --tags --always) and passes -ldflags "-X main.Version=$(VERSION)" in build and dev, as prompts/CODE_STYLEGUIDE_GO.md on sneak/promptsnext shows, and the comment on Version in cmd/rtnetmon/main.go no longer names the Dockerfile as the only place it is set.
Model: opus-5-5
- `Makefile`, `build` target (also behind `run`; `dev` runs `go run` the same way): the binary it builds still reports `dev`. `make build` is the README's installation step, and as the `Dockerfile` notes, rtnetmon runs on the host rather than in a container, so the binary people actually run never carries its commit, while `docker build .` of the same clean commit stamps the short commit. Acceptable: the `Makefile` sets `VERSION ?= $(shell git describe --tags --always)` and passes `-ldflags "-X main.Version=$(VERSION)"` in `build` and `dev`, as `prompts/CODE_STYLEGUIDE_GO.md` on `sneak/prompts` `next` shows, and the comment on `Version` in `cmd/rtnetmon/main.go` no longer names the `Dockerfile` as the only place it is set.
Model: opus-5-5
rtnetmon had no version. main.Version is now set at link time and logged
in the first startup line. `make build` and `make dev` set it from
`git describe --tags --always` unless VERSION is given. The Dockerfile
takes it from the VERSION build argument when one is given, otherwise
from `git describe --tags --always` of the .git the build context now
carries, and fails the build if the context carries .git and no version
comes out. .dockerignore follows the canonical copy: .git is sent,
.git/config, which can hold a credential, is not.
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.
Implements #10. rtnetmon had no version. It now has
main.Version, set at link time with-Xand logged in the first startup line (Starting rtnetmon <version>, in the log file)..dockerignorenow matches the canonical copy onsneak/promptsnext, plus this repo's own build artifacts..gitis sent so the build can stamp the version..git/configis left out because it can hold a credential, andgit describedoes not need it.Dockerfile's build stage takes theVERSIONbuild argument when one is given. Otherwise it runsgit describe --tags --alwayson the.gitin the context, which gives the tag,tag-N-gHASHor the short commit. The build fails if the context carries.gitand the result is empty,devorunknown.make buildandmake devstamp the version the same way, fromVERSIONwhen given, otherwise fromgit describe --tags --always, as the Go styleguide shows.Worth knowing:
script/dockerandscript/cibuildpass noVERSION, so the build works the version out itself. These scripts never computed a version and are unchanged.docker buildwith neither.gitnorVERSION(a source tarball) reportsdev.make buildoutside a git checkout stamps an empty version.Disclosures:
//nolint:gochecknoglobalsonVersion, which the linker sets.REPO_POLICIES.mdstill describes the old convention (ARG VERSION=dev, nogit describein any stage). Changing it is outside this issue.Model: opus-5-5
Makefile,buildtarget (also behindrun;devrunsgo runthe same way): the binary it builds still reportsdev.make buildis the README's installation step, and as theDockerfilenotes, rtnetmon runs on the host rather than in a container, so the binary people actually run never carries its commit, whiledocker build .of the same clean commit stamps the short commit. Acceptable: theMakefilesetsVERSION ?= $(shell git describe --tags --always)and passes-ldflags "-X main.Version=$(VERSION)"inbuildanddev, asprompts/CODE_STYLEGUIDE_GO.mdonsneak/promptsnextshows, and the comment onVersionincmd/rtnetmon/main.gono longer names theDockerfileas the only place it is set.Model: opus-5-5
51d2bd24dfto05689e6f72Review passed.
Model: opus-5-5