Documentation
¶
Overview ¶
Package buildinfo identifies this conch binary, so a client can tell whether a remote machine runs the same build.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Commit string
Commit is the git commit this conch was built from, set with -ldflags -X by `make build` and macos/bundle.sh. Building conch for another machine reads it: a source tree that has since moved to another commit (or was left behind on an older one) is built at this commit instead, so the machine gets this conch, not the tree's. "" when unknown.
var SourceBuild string
SourceBuild is set (with -ldflags -X) on binaries cross-built for another platform: the build of the conch they were built alongside. Their own hash differs from it, but they are the same build.
Functions ¶
func Build ¶
func Build() string
Build is a short hash of the running executable; "" if it can't be read. Rebuilding changes it even when the version string doesn't. Call it early: it hashes the file as it is on disk at the first call.
func Executable ¶ added in v0.1.9
Executable is the path conch should be found at again later: what os.Executable says, except for a Homebrew install, which is the formula's opt link rather than the versioned keg the program runs from. Agent hooks written with this path, a server reloaded from it, a TUI restarted onto it: each outlives `brew upgrade`, which puts the new version in a new keg and deletes the old one — os.Executable resolves to that keg on Linux, and so would the hooks.
func Homebrew ¶ added in v0.1.9
Homebrew says whether the conch at path was installed by Homebrew, which is then the one to update it: replacing the file under it leaves brew believing in a version that is no longer there.
func ID ¶
func ID() string
ID identifies the build across platforms: the source build for a cross-built binary, else its own hash.
func ResolveVersion ¶
func ResolveVersion()
ResolveVersion names a `go install github.com/Amitgb14/conch/cmd/conch@v0.1.0` build after its release. Such builds skip the release -ldflags and would otherwise call themselves the development version, so self-updates and same-build checks would treat them as dev builds.
Types ¶
type Info ¶
type Info struct {
Version string `json:"version"`
Build string `json:"build"`
BuildID string `json:"build_id,omitempty"`
Platform string `json:"platform"`
Capabilities []string `json:"capabilities"`
// Optional are those of Capabilities a server of this build may leave
// out on a machine that cannot give them (proto.OptionalCapabilities):
// a server lacking one is not from an older build.
Optional []string `json:"optional,omitempty"`
}
Info is what `conch version --json` prints.