Documentation
¶
Overview ¶
Package version exposes build metadata about the compiled binary.
The exported variables are populated via -ldflags -X by scripts/build.sh. When the binary is built without them, the commit metadata reports "unknown" and Version falls back to the version the module system resolved, so a `go install ...@v0.1.0` names the tag rather than claiming to be a development build. See resolve for the rule.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // CommitHash is the git commit the binary was built from. CommitHash = unknown // BuildTime is the UTC timestamp the binary was built at. BuildTime = unknown // CommitTime is the committer timestamp of CommitHash. CommitTime = unknown )
Build metadata, injected at link time by scripts/build.sh.
var Version = development
Version is the release this binary claims to be, and the only version string that reaches generated code.
It is deliberately not CommitHash. Generated files carry the generator's version so a consumer can tell what produced them, and a commit hash would change that line on every build — turning every unrelated rebuild into a diff for consumers who gate CI on a clean tree after regeneration. A release moves this; a build does not.
-ldflags -X writes here directly, which is why the fallback below runs in init rather than in this variable's initializer: the linker's value has to be in place before anything can decide whether it needs replacing.
Functions ¶
This section is empty.
Types ¶
This section is empty.