Documentation
¶
Overview ¶
Package buildinfo contains build information.
Exported string variables may be set during compilation using a linker flag like this:
go build -ldflags '-X src.elv.sh/pkg/buildinfo.NAME=VALUE' ./cmd/elvish
This mechanism can be used by packagers to enhance Elvish's version information. The variables that can be set are documented below.
BuildVariant ¶
BuildVariant, if non-empty, gets appended to the version string along with a "+" prefix. It should be set to a value identifying the build environment.
Typically, this should be the name of the software distribution that is packaging Elvish, possibly plus the revision of the package. Example for revision 1 of a Debian package:
go build -ldflags '-X src.elv.sh/pkg/buildinfo.BuildVariant=deb1' ./cmd/elvish
Supposing that VersionBase is "0.233.0", this causes "elvish -version" to print out "0.233.0+deb1".
The value "official" is reserved for official binaries linked from https://elv.sh/get. Do not use it unless you can ensure that your build is bit-to-bit identical with the official binaries and you are committing to maintaining that property.
VCSOverride ¶
On development commits, Elvish uses the information from Git to generate a version string like (following the format of Go module pseudo-versions):
0.234.0-dev.0.20220320172241-5dc8c02a32cf
where 20220320172241 is the commit time (in YYYYMMDDHHMMSS) and 5dc8c02a32cf is the first 12 digits of the commit hash.
If this information is not available when Elvish was built - for example, if the build works from an archive of the commit rather than a Git checkout - the version string will instead look like this:
0.234.0-dev.unknown
In that case, VCSOverride can be set to to supply the $time-$commit information:
go build -ldflags '-X src.elv.sh/pkg/buildinfo.VCSOverride=20220320172241-5dc8c02a32cf' ./cmd/elvish
Setting this variable is only necessary when building development commits and the VCS information is not available.
Index ¶
Constants ¶
const VersionBase = "0.21.0"
VersionBase identifies the version of Elvish.
On release branches, it identifies the exact version of the commit, and is consistent with the Git tag. For example, at tag v0.233.0, this will be "0.233.0".
On development branches, it identifies the first version of the next release branch. For example, after releases for 0.233.x has been branched but before 0.234.x is branched, this will be "0.244.0". The full version string will be augmented with VCS information (see VCSOverride).
In both cases, the full version is also augmented with the BuildVariant.
Variables ¶
var BuildVariant string
BuildVariant may be set to identify the build environment. See the package godoc for more details.
var VCSOverride string
VCSOverride may be set to identify the commit of development builds when that information is not available during build time. It has no effect on release branches. See the package godoc for more details.
var Value = Type{ Version: addVariant(VersionBase, BuildVariant), GoVersion: runtime.Version(), }
Value contains all the build information.
Functions ¶
This section is empty.
Types ¶
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
Program is the buildinfo subprogram.