Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExtraFields ¶ added in v1.1.0
type ExtraFields any
ExtraFields provides an option to pass extra fields.
type Info ¶
type Info struct { Version string `yaml:"version,omitempty" json:"version,omitempty"` GitCommit string `yaml:"gitCommit,omitempty" json:"gitCommit,omitempty"` BuildDate string `yaml:"buildDate,omitempty" json:"buildDate,omitempty"` CommitDate string `yaml:"commitDate,omitempty" json:"commitDate,omitempty"` DirtyBuild bool `yaml:"dirtyBuild,omitempty" json:"dirtyBuild,omitempty"` GoVersion string `yaml:"goVersion,omitempty" json:"goVersion,omitempty"` Compiler string `yaml:"compiler,omitempty" json:"compiler,omitempty"` Platform string `yaml:"platform,omitempty" json:"platform,omitempty"` Meta Meta `json:"-" yaml:"-"` ExtraFields ExtraFields `json:"-" yaml:"-"` }
Info contains versioning information.
func Get ¶
func Get() *Info
Get returns the overall codebase version. It's for detecting what code a binary was built from.
Version related variables are resolved in such order:
- Go -ldflags
- or debug.ReadBuildInfo() in Go 1.18+ * version is set only if the binary is built with "go install url/tool@version". * commit is taken from the vcs.revision tag. * commitDate is taken from the vcs.time tag. * dirtyBuild is taken from the vcs.modified tag.
- in their absence fallback to the settings in ./base.go.
func (*Info) MarshalJSON ¶ added in v1.1.0
MarshalJSON marshal data into JSON but ensures that extra fields are inlined.
func (*Info) MarshalYAML ¶ added in v1.1.0
MarshalYAML marshal data into YAML but ensures that extra fields are inlined.
Click to show internal directories.
Click to hide internal directories.