Documentation
¶
Index ¶
Constants ¶
View Source
const ( FlagFormat = "format" FlagFormatShortHand = "f" FlagFormatOCMv1 = "legacyjson" FlagFormatGoBuildInfo = "gobuildinfo" FlagFormatGoBuildInfoJSON = "gobuildinfojson" )
Variables ¶
View Source
var BuildVersion = "n/a"
BuildVersion is an external variable that can be set at build time to override the version. It is set to "n/a" by default, indicating that no version has been specified. The variable can be adjusted at build time with
-ldflags "-X ocm.software/open-component-model/cli/cmd/version.BuildVersion=1.2.3"
The build version accepted is interpreted differently depending on the format:
- For `ocmv1`, it is expected to be a semantic version (e.g., "1.2.3") and will be split for a json like output
- For `gobuildinfo`, it can be any version string, including a full semantic version. If set, it will override the detected module build version from the Go build info.
Functions ¶
Types ¶
type LegacyVersionInfo ¶
type LegacyVersionInfo struct {
Major string `json:"major"`
Minor string `json:"minor"`
Patch string `json:"patch"`
PreRelease string `json:"prerelease,omitempty"`
Meta string `json:"meta,omitempty"`
GitVersion string `json:"gitVersion"`
GitCommit string `json:"gitCommit,omitempty"`
BuildDate string `json:"buildDate,omitempty"`
GoVersion string `json:"goVersion"`
Compiler string `json:"compiler"`
Platform string `json:"platform"`
}
func GetLegacyFormat ¶
func GetLegacyFormat(bi *debug.BuildInfo) (LegacyVersionInfo, error)
GetLegacyFormat returns the build information in a legacy format compatible with OCM v1 CLI specifications.
Click to show internal directories.
Click to hide internal directories.