version

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package version 承载构建期注入的版本信息。

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version 语义化版本号,发布构建由 goreleaser 注入 tag。
	Version = "0.0.0-dev"
	// Commit git 提交短哈希。
	Commit = "unknown"
	// Date 构建时间,RFC 3339 格式。
	Date = "unknown"
)

以下变量由链接器在构建时注入,见 Taskfile.yml 与 .goreleaser.yaml。 默认值对应「从源码直接 go build / go run」的场景。

Functions

This section is empty.

Types

type Info

type Info struct {
	Version   string `json:"version"`
	Commit    string `json:"commit"`
	Date      string `json:"date"`
	GoVersion string `json:"goVersion"`
	Platform  string `json:"platform"`
}

Info 汇总一次构建的完整版本信息。

func Get

func Get() Info

Get 返回当前构建的版本信息。 未经链接器注入时,尝试从 VCS 构建信息中回填提交哈希,方便本地调试。

func (Info) String

func (i Info) String() string

String 返回单行可读版本描述。

Jump to

Keyboard shortcuts

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