vars

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Appname 应用程序的名称
	Appname string
	// GitCommit 最后一次git提交的hash值,计算方式:git rev-parse HEAD
	GitCommit string
	// BuildDate 编译二进制时的时间,RFC3339规范,计算方式:date -u +'%Y-%m-%dT%H:%M:%SZ'
	BuildDate string
	// GitBranch 编译时所在的git分支,计算方式:git rev-parse --abbrev-ref HEAD
	GitBranch string
	// CliVersion 生成该服务模版所使用的 github.com/grpc-kit/cli 版本
	CliVersion string
	// CommitUnixTime 最后一次git提交的UNIX时间,计算方式:git --no-pager log -1 --format='%ct'
	CommitUnixTime string
	// ReleaseVersion 服务正式发布对外的版本,计算方式:git describe --tags --dirty --always
	ReleaseVersion string
)

Functions

This section is empty.

Types

type Info

type Info struct {
	Appname        string `json:"appname" yaml:"appname"`
	BuildDate      string `json:"build_date" yaml:"build_date"`
	GitCommit      string `json:"git_commit" yaml:"git_commit"`
	GitBranch      string `json:"git_branch" yaml:"git_branch"`
	GoVersion      string `json:"go_version" yaml:"go_version"`
	Compiler       string `json:"compiler" yaml:"compiler"`
	Platform       string `json:"platform" yaml:"platform"`
	CliVersion     string `json:"cli_version" yaml:"cli_version"`
	CommitUnixTime int64  `json:"commit_unix_time" yaml:"commit_unix_time"`
	ReleaseVersion string `json:"release_version" yaml:"release_version"`
}

Info 用于记录版本相关信息结构

func GetVersion

func GetVersion() Info

GetVersion 用于转换编译时的静态信息,如版本号等,同时为未设置变量参数设置默认值(对于直接访问变量则无法提供默认值)

func (Info) String

func (info Info) String() string

String 用于统一标准化格式输出

Jump to

Keyboard shortcuts

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