Documentation ¶
Index ¶
- Constants
- func AddFlags(fs *pflag.FlagSet)
- func PrintAndExitIfRequested()
- func SetDynamicVersion(dynamicVersion string) error
- func ValidateDynamicVersion(dynamicVersion string) error
- func Version(name string, value versionValue, usage string) *versionValue
- func VersionVar(p *versionValue, name string, value versionValue, usage string)
- type Info
Constants ¶
View Source
const ( // 未设置版本. VersionNotSet versionValue = 0 // 启用版本. VersionEnabled versionValue = 1 // 原始版本. VersionRaw versionValue = 2 )
定义一些常量.
Variables ¶
This section is empty.
Functions ¶
func PrintAndExitIfRequested ¶
func PrintAndExitIfRequested()
PrintAndExitIfRequested 将检查是否传递了 `--version` 标志,如果是,则打印版本并退出.
func SetDynamicVersion ¶
SetDynamicVersion overrides the version returned as the GitVersion from Get(). The specified version must be non-empty, a valid semantic version, and must match the major/minor/patch version of the default gitVersion.
func ValidateDynamicVersion ¶
ValidateDynamicVersion ensures the given version is non-empty, a valid semantic version, and matched the major/minor/patch version of the default gitVersion.
func VersionVar ¶
VersionVar 定义了一个具有指定名称和用法的标志.
Types ¶
type Info ¶
type Info struct { GitVersion string `json:"gitVersion"` GitCommit string `json:"gitCommit"` GitTreeState string `json:"gitTreeState"` BuildDate string `json:"buildDate"` GoVersion string `json:"goVersion"` Compiler string `json:"compiler"` Platform string `json:"platform"` }
Info 包含了版本信息.
Click to show internal directories.
Click to hide internal directories.