Documentation
¶
Overview ¶
Package buildinfo stores information about an applications current build.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRunNameForProgram ¶
func GetRunNameForProgram() string
GetRunNameForProgram returns the base name of the running program.
Types ¶
type Info ¶
type Info struct {
// Architecture is the build processor architecture.
Architecture string
// BuiltBy who/what build this version.
BuiltBy string
// Date compiled.
Date string
// Commit used for build.
Commit string
// CompiledName compile name used for build.
CompiledName string
// Compiler used to build
Compiler string
// OperatingSystem is the build operating system.
OperatingSystem string
// RunName is the name of the program obtained from arg[0].
RunName string
// Start dir is the working directory when the program starts.
StartDir string
// Version is the version of the program.
Version string
}
Info is information about the build.
func GetBuildInfo ¶
GetBuildInfo returns the run context.
func NewInfo ¶
NewInfo creates a new info from the passed arguments. Use NewInfo to pass in the information captured from link flags.
Eg --ldflags "-s -w -X main.version={{ .Version }} -X main.commit={{ .Commit }} -X main.date={{ .CommitDate }} -X main.builtBy={{ .Env.BUILTBY }}".
func (Info) BasicVersion ¶ added in v0.2.1
BasicVersion converts the build info to a string.
func (Info) NewContext ¶
NewContext creates a new context containing the build information.
func (Info) TabularVersion ¶ added in v0.2.1
TabularVersion converts the build info to a tabular string.