buildinfo

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package buildinfo exposes metadata embedded by the Go linker at build time.

Index

Constants

This section is empty.

Variables

View Source
var (
	// 这些字符串变量由发布构建通过 -ldflags -X 覆盖;本地开发构建保留可识别的默认值。
	Version   = "dev"
	Commit    = "unknown"
	BuildDate = "unknown"
)

Functions

This section is empty.

Types

type Info

type Info struct {
	Version   string `json:"version"`
	Commit    string `json:"commit"`
	BuildDate string `json:"build_date"`
}

Info 是 CLI 可安全展示的构建元数据。

func Current

func Current() Info

Current 返回当前二进制嵌入的构建元数据。

func (Info) IsDevelopment

func (info Info) IsDevelopment() bool

IsDevelopment 仅根据版本号判断开发构建,供更新功能在未来拒绝 dev 二进制时使用。

Jump to

Keyboard shortcuts

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