buildinfo

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

View Source
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

func Executable() (string, error)

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 HashFile

func HashFile(path string) string

HashFile is the build hash of the executable at path; "" if unreadable.

func Homebrew added in v0.1.9

func Homebrew(path string) bool

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 Platform

func Platform() string

Platform is GOOS/GOARCH of this binary, e.g. "darwin/arm64".

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.

func Stable added in v0.1.9

func Stable(path string) string

Stable is path, or for a binary in a Homebrew keg its formula's opt link (PREFIX/opt/conch/bin/conch), while that link leads to the same file.

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.

func Current

func Current() Info

Current describes this binary.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL