Documentation
¶
Overview ¶
Package version answers what build of rig this is.
Three kinds of binary have to answer it, and only one of them is built by the release:
- `go install github.com/simonjanss/rig/cmd/rig@v0.3.0` stamps nothing, but the module version is in the build info, and it is exact.
- A release archive is built with -ldflags, because goreleaser knows the tag before the compiler does.
- `make build` from a checkout has neither, and what is useful there is the commit — which the toolchain records on its own, except in a git worktree, where it records nothing. So the commit is reported when it is there and the version stands alone when it is not, rather than being relied on.
So the answer is assembled from whatever of those is present, in that order of trust, and never guessed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Info ¶
type Info struct {
// Version is a semantic version for a released build, "(devel)" for one
// built from a checkout, and "unknown" when there is no build info at all —
// which happens under `go test`, and is not worth pretending otherwise.
Version string
// Revision is the commit, when the toolchain recorded one. Empty for a
// build made from an unpacked module zip, which carries no repository.
Revision string
// Time is the commit time, in RFC 3339, on the same terms as Revision.
Time string
// Modified reports that the working tree had uncommitted changes. A true
// here is why two binaries reporting the same Revision can differ.
Modified bool
// Go is the toolchain that built it.
Go string
}
Info is what a build knows about itself.
Click to show internal directories.
Click to hide internal directories.