Documentation
¶
Overview ¶
Package version 保存 STX 服务端、CLI 与 Agent 共用的产品版本信息。 Package version stores product version information shared by the STX server, CLI, and Agent.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BuildTime = "unknown"
BuildTime 是构建时间(UTC),可在发布构建中通过 ldflags 覆盖。 BuildTime is the UTC build timestamp and can be overridden with ldflags.
var GitCommit = "unknown"
GitCommit 是构建时的短提交哈希,可在发布构建中通过 ldflags 覆盖。 GitCommit is the short commit hash at build time and can be overridden with ldflags.
var MinCLIVersion = "1.0.0"
MinCLIVersion 是当前服务端接受的最低 CLI 版本;破坏兼容时手动抬高。 MinCLIVersion is the minimum CLI version accepted by the current server; raise manually on breaking changes.
var Version = "1.0.0"
Version 是当前 STX 发布版本,可在发布构建中通过 ldflags 覆盖。 Version is the current STX release version and can be overridden with ldflags.
Functions ¶
func Compare ¶ added in v1.0.0
Compare 比较两个 SemVer 风格版本(可带 v 前缀),返回 -1/0/1。 Compare compares two SemVer-like versions (optional v prefix) and returns -1/0/1.
func CompatibilityWarning ¶ added in v1.0.0
CompatibilityWarning 生成 CLI 过旧时的提示文案。 CompatibilityWarning builds the message shown when the CLI is below the minimum.
func IsBelowMin ¶ added in v1.0.0
IsBelowMin 判断当前 CLI 版本是否低于服务端要求的最低版本。 IsBelowMin reports whether the CLI version is below the server minimum.
func Normalize ¶ added in v1.0.0
Normalize 去掉可选的 v 前缀并修剪空白。 Normalize strips an optional leading v and trims whitespace.
func ValidateReleaseVersion ¶ added in v1.2.0
ValidateReleaseVersion 校验发布版本字符串,拒绝空值、路径分隔符、".."、绝对路径及非版本格式输入。 ValidateReleaseVersion validates a release version string and rejects empty values, path separators, "..", absolute paths, and anything that is not a version such as v1.2.3 or 1.2.3-beta.1.