Documentation ¶
Overview ¶
Package vergen generate version info with go generate
Index ¶
Constants ¶
const ( DefaultPkgName = "version" DefaultDirtyString = "+" DefaultTimeout = 15 * time.Second )
Variables ¶
var DirtyString = DefaultDirtyString
DirtyString is a string appended to the VgVersion constant if you have uncommitted changes in your current repo.
var IgnoreFiles = []string{"version.go"}
IgnoreFiles is an array of filenames that vergen should ignore when trying to detect uncommitted changes. By default it contains only "version.go" which if it is the only file changed doesn't affect the runtime behaviour of your software.
var Timeout = DefaultTimeout
Timeout is of type time.Duration and is the amount of time vergen will wait for each git command it runs to complete before killing it.
Functions ¶
func Create ¶
func Create() error
Create will create a file named version.go in the directory you ran 'go generate', that will contain three constants:
VgVersion: The version of your repo as given by 'git describe --tags' plus the DirtyString variable if you have uncommitted changes.
VgHash: The SHA1 hash of your current commit.
VgClean: indicates whether your build is clean or it includes uncommitted changes.
func CreateFile ¶
CreateFile will work as Create() but instead of writing version.go in the directory you ran 'go generate' in, it will write filename instead (which may include a path).
Types ¶
This section is empty.