version

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

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

View Source
var BuildTime = "unknown"

BuildTime 是构建时间(UTC),可在发布构建中通过 ldflags 覆盖。 BuildTime is the UTC build timestamp and can be overridden with ldflags.

View Source
var GitCommit = "unknown"

GitCommit 是构建时的短提交哈希,可在发布构建中通过 ldflags 覆盖。 GitCommit is the short commit hash at build time and can be overridden with ldflags.

View Source
var MinCLIVersion = "1.0.0"

MinCLIVersion 是当前服务端接受的最低 CLI 版本;破坏兼容时手动抬高。 MinCLIVersion is the minimum CLI version accepted by the current server; raise manually on breaking changes.

View Source
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

func Compare(left, right string) int

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

func CompatibilityWarning(cliVersion, minVersion, serverVersion string) string

CompatibilityWarning 生成 CLI 过旧时的提示文案。 CompatibilityWarning builds the message shown when the CLI is below the minimum.

func IsBelowMin added in v1.0.0

func IsBelowMin(cliVersion, minVersion string) bool

IsBelowMin 判断当前 CLI 版本是否低于服务端要求的最低版本。 IsBelowMin reports whether the CLI version is below the server minimum.

func Normalize added in v1.0.0

func Normalize(v string) string

Normalize 去掉可选的 v 前缀并修剪空白。 Normalize strips an optional leading v and trims whitespace.

Types

type Info added in v1.0.0

type Info struct {
	Version   string `json:"version" yaml:"version"`
	GitCommit string `json:"git_commit" yaml:"git_commit"`
	BuildTime string `json:"build_time" yaml:"build_time"`
}

Info 是对外暴露的构建信息快照。 Info is the public build-information snapshot.

func Current added in v1.0.0

func Current() Info

Current 返回当前进程的构建信息。 Current returns build information for the current process.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL