Documentation
¶
Overview ¶
Package version resolves boid's own version identity, per docs/plans/release-onboarding.md 穴2 ("バージョン identity が存在しない").
There are two independent build shapes to reconcile:
- `go install github.com/novshi-tech/boid@latest` cannot pass -ldflags, so the CLI has to fall back to debug.ReadBuildInfo()'s Main.Version — the module version Go itself resolved at install time.
- the daemon/sandbox container image is built from `COPY . .` inside build/container/Dockerfile, whose build context excludes .git/ (see .dockerignore) — so a plain `go build` there produces a binary whose build info reports "(devel)" no matter what git tag HEAD sits on. The image build bakes the real version in instead, via a build-arg threaded into `go build -ldflags "-X .../internal/version.buildVersion=..."`.
Version() prefers the ldflags override when present and falls back to debug.ReadBuildInfo() otherwise, so callers never need to know which of the two build shapes produced the running binary.
Index ¶
Constants ¶
const BoidRunnerImageRepo = "ghcr.io/novshi-tech/boid-runner"
BoidRunnerImageRepo is the GHCR repository .github/workflows/ blackbox-e2e.yml's container-image job publishes to (docs/plans/ release-onboarding.md 決定4/PR3): a tag push building an exact release (BOID_VERSION non-empty there, mirroring IsExactRelease's own rule) additionally publishes "$BoidRunnerImageRepo:<the release tag>" — exactly the ref DefaultContainerImage names for a release build.
const LocalBuildImage = "boid-runner:latest"
LocalBuildImage is the bare, unqualified tag scripts/deploy-container.sh's local `docker build` step produces (its own `-t boid-runner:latest`, stacked alongside the git-SHA-derived IMAGE_TAG it also applies) and build/container/compose.yml's daemon service ultimately resolves to whenever a caller hasn't overridden BOID_IMAGE — the local-checkout dev workflow's own default. DefaultContainerImage falls back to this exact string for any non-release build (穴2's broad rule) since there is no GHCR ref to name for a build that was never published.
Variables ¶
This section is empty.
Functions ¶
func DefaultContainerImage ¶
func DefaultContainerImage() string
DefaultContainerImage returns the image ref a boid binary should default to launching (job containers) or pulling (the compose daemon service) for its OWN version identity — docs/plans/release-onboarding.md 穴4's "pull の既定 ref にレジストリが無い" fix. For an exact release build (IsReleaseBuild), this is that release's own GHCR tag, matching exactly what the CI publish step (BoidRunnerImageRepo's own doc comment) pushes for the same tag. For every other build shape — dev checkout, pseudo- version, "+dirty", "(devel)" (穴2's rule is deliberately broad here, see exactReleaseTagPattern's doc comment) — there is no corresponding published GHCR ref to name, so this instead names LocalBuildImage, the bare local tag scripts/deploy-container.sh's own local build step produces and e2e/run-container.sh's local-build flow already depends on.
func IsExactRelease ¶
IsExactRelease reports whether v names an exact release tag under 穴2's rule. See exactReleaseTagPattern's doc comment for what disqualifies a string.
func IsReleaseBuild ¶
func IsReleaseBuild() bool
IsReleaseBuild reports whether the running binary's effective Version() names an exact release tag. This is the check callers actually want — composing Version() and IsExactRelease() themselves would be equivalent, but this spares every call site from needing to know that.
func Version ¶
func Version() string
Version returns the effective version identity of the running boid binary: the ldflags-injected buildVersion when the binary was built with it (the image build shape), otherwise whatever debug.ReadBuildInfo() reports as the main module's version (the `go install` shape — see the package doc comment). Returns "" if neither source has anything to say, which callers should treat the same as any other non-release value under IsExactRelease.
Types ¶
This section is empty.