Documentation
¶
Overview ¶
Package xver stores the project's information like version, name, and build.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// Name holds the application name.
// Defaults to executable name.
//
// You can set it during build time with -X 'github.com/actforgood/xver.name=<appName>'.
Name string `json:"name"`
// Version holds the application version.
// Defaults to [debug.BuildInfo.Main.Version].
//
// You can set it during build time with -X 'github.com/actforgood/xver.version=<appVersion>'.
//
// Note from go1.24 release:
// The go build command now sets the main module’s version in the compiled binary based on
// the version control system tag and/or commit. A +dirty suffix will be appended if there
// are uncommitted changes. Use the -buildvcs=false flag to omit version control information
// from the binary.
Version string `json:"version"`
}
App holds basic application information, like name and version.
type Build ¶
type Build struct {
// Go holds the go version application was compiled with.
//
// It is taken from [debug.ReadBuildInfo], if available.
Go string `json:"go"`
// Arch is the architecture binary was build for.
//
// It is taken from [debug.ReadBuildInfo], if available.
Arch string `json:"arch"`
// OS is the operating system binary was build for.
//
// It is taken from [debug.ReadBuildInfo], if available.
OS string `json:"os"`
// Commit is the commit sha.
//
// It is taken from [debug.ReadBuildInfo], if available.
//
// You can set it during build time with -X 'github.com/actforgood/xver.commit=<gitCommit>'.
Commit string `json:"commit,omitempty"`
// Date is application build date.
//
// It is taken from [debug.ReadBuildInfo], if available.
//
// You can set it during build time with -X 'github.com/actforgood/xver.date=<buildDate>'.
Date string `json:"date"`
}
Build holds basic build information, like the go version used and application built time.
type Info ¶
type Info struct {
// App holds app info.
App App `json:"app"`
// Build holds build info.
Build Build `json:"build"`
}
Info holds basic build information about an application.
Some information may not be available, by default.
To set the app name / app version / build date you can use `-X` option when running `go build` cmd.
Click to show internal directories.
Click to hide internal directories.