Documentation ¶
Overview ¶
Package info provides the build information of a command or module.
Index ¶
Constants ¶
View Source
const ( // RepoPathSepNum is the number of the repository path separator. RepoPathSepNum = 3 // DebugRevisionLen is the length of the debug revision. DebugRevisionLen = 12 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct { // Path contains the package path of the command or module. Path string `yaml:"path,omitempty" json:"path,omitempty"` // Repo contains the repository of the command or module. Repo string `yaml:"repo,omitempty" json:"repo,omitempty"` // Version contains the actual version of the command or module. Version string `yaml:"version,omitempty" json:"version,omitempty"` // Revision contains the revision of the command or module from version // control system. Revision string `yaml:"revision,omitempty" json:"revision,omitempty"` // Build contains the build time of the command or module. Build time.Time `yaml:"build,omitempty" json:"build,omitempty"` // Commit contains the last commit time of the command or module from the // version control system. Commit time.Time `yaml:"commit,omitempty" json:"commit,omitempty"` // Dirty flags whether the build of the command or module is based on a // dirty local repository state. Dirty bool `yaml:"dirty,omitempty" json:"dirty,omitempty"` // Checksum contains the check sum of the command or module. Checksum string `yaml:"checksum,omitempty" json:"checksum,omitempty"` // Go contains the go version the command or module was build with. Go string `yaml:"go,omitempty" json:"go,omitempty"` // Platform contains the build platform the command or module was build // for. Platform string `yaml:"platform,omitempty" json:"platform,omitempty"` // Compiler contains the actual compiler the command or module was build // with. Compiler string `yaml:"compiler,omitempty" json:"compiler,omitempty"` }
Info provides the build information of a command or module.
func NewInfo ¶
NewInfo returns the build information of a command or module using given custom version and custom build time using RFC3339 format. The provided version must follow semantic versioning as supported by go.
func (*Info) AdjustVersion ¶
AdjustVersion adjusts the version of the build information of a command or module if the version does not follow semantic versioning as supported by go. The version is adjusted using the revision and commit time of the build information. If the revision is not available the version is not changed.
Click to show internal directories.
Click to hide internal directories.