version

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package version 提供构建时注入的版本信息。 变量由 Makefile 通过 -ldflags 在编译时注入,开发时为默认值。

Index

Constants

This section is empty.

Variables

View Source
var BuiltAt = "unknown"

BuiltAt 是 UTC 构建时间(RFC3339),构建时由 Makefile 注入。

View Source
var Commit = "unknown"

Commit 是 git 短 hash,构建时由 Makefile 注入。

View Source
var Version = "dev"

Version 是 git tag(如 v1.0.0),构建时由 Makefile 注入。

Functions

func Full

func Full(binary string) string

Full 返回多行详细版本信息,用于 version 子命令。

func Short

func Short() string

Short 返回单行版本字符串,用于 cobra rootCmd.Version(cobra 会自动添加 "<binary> version " 前缀)。

v1.2.0 (abc1234) built 2025-01-01T00:00:00Z

Types

This section is empty.

Jump to

Keyboard shortcuts

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