Documentation
¶
Overview ¶
Package buildinfo names the source and moment that produced this codeaf.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // StableTag matches a stable release tag, with its three components as // submatches. StableTag = regexp.MustCompile(`^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$`) // CandidateTag matches a release-candidate tag, with its three components // and its counter as submatches. CandidateTag = regexp.MustCompile(`^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)-rc\.([1-9][0-9]*)$`) // DevTag matches a build published on the dev channel. DevTag = regexp.MustCompile(`^dev-[0-9]{8}-[0-9a-f]{12}$`) // StagingTag matches a build published on the staging channel. StagingTag = regexp.MustCompile(`^staging-[0-9]{8}-[0-9a-f]{12}$`) )
Functions ¶
func BuiltAt ¶
BuiltAt is the moment `make build` stamped into this binary, and the zero time for a build that carries no stamp (a bare `go build`, a test binary). It is how two builds are put in ORDER, which Identity deliberately cannot do: identity says whether two builds are the same source, never which came first.
func Channel ¶
Channel names the release channel a tag was cut on: "stable", "rc", "dev", "staging", or "other" for anything the release workflow does not cut — a commit, a module pseudo-version, an empty string.
func Dirty ¶
func Dirty() bool
Dirty reports whether the running binary was built from a modified tree, read from the same build settings Identity derives from. Callers that need the build's honesty — telemetry's opt-out ladder — ask here rather than parsing a display string.
func Identity ¶
func Identity() string
Identity names the engine this process is. Info.Identity is the rule.
func Revision ¶
func Revision() string
Revision returns the stable source identity without the build-time details.
func StaleNotice ¶
func StaleNotice() string
StaleNotice reports when this process's executable has been replaced.
Types ¶
type Detector ¶
type Detector struct {
// contains filtered or unexported fields
}
Detector notices each replacement of one running executable once.
func NewDetector ¶
NewDetector makes a detector whose clock boundary is the process start.
type Info ¶
Info is the immutable identity carried by this running program.
func (Info) Identity ¶
Identity names the engine a running process is, as far as a build can be told from another one.
A BUILD THAT CAN NAME ITS SOURCE IS THAT SOURCE AND NOTHING ELSE. Two `make build` runs on one unmodified commit produce the same program, so they produce the same engine — and the door that decides whether to attach must not read a difference nobody made. It did: the build moment was in here, so a window built thirteen seconds after the engine it met was told it had met an older codeaf.
A BUILD THAT CANNOT NAME ITS SOURCE KEEPS THE MOMENT IT WAS MADE. A modified tree spells the same revision before and after an edit, and an unstamped build spells none at all; the moment is then the only thing that tells one rebuild from the next, and somebody rebuilding what they just edited must still get a new engine.