version

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package version

@author: xwc1125

Index

Constants

View Source
const (
	// VersionMeta_Stable 稳定版本
	VersionMeta_Stable = "stable"
)

Variables

View Source
var (
	FilePath string = "./"
	// Version 版本号
	Version string
	// VersionMeta :"stable","beta","alpha"
	// 如果为stable,那么返回主版本:0.0.1
	// 否则,那么返回子版本:0.0.1.1
	VersionMeta string
	// BuildTime 编译时间
	BuildTime string
	// GitHash 当前的Git Hash码
	GitHash string
	// GitDate 当前的Git 提交时间
	GitDate string
	// BuildNumber 编译次数
	BuildNumber string
)
View Source
var ArchiveVersion = func() string {
	vsn := GetVersion()
	if VersionMeta != "" {
		vsn += "-" + VersionMeta
	}
	if len(GitHash) >= 8 {
		vsn += "-" + GitHash[:8]
	}
	return vsn
}

ArchiveVersion 归档版本号:带commit

View Source
var VersionWithCommit = func() string {
	vsn := VersionWithMeta()
	if len(GitHash) >= 8 {
		vsn += "-" + GitHash[:8]
	}
	if GitDate != "" {
		vsn += "-" + GitDate
	}
	return vsn
}

VersionWithCommit 带commit的版本

View Source
var VersionWithMeta = func() string {
	v := GetVersion()
	if VersionMeta != "" {
		v += "-" + VersionMeta
	}
	return v
}

VersionWithMeta 带meta的版本号

Functions

func Build

func Build(preMsg string) bool

Build 编译 preMsg 打印的内容

func GetVersion

func GetVersion() string

GetVersion 获取版本号

Types

This section is empty.

Directories

Path Synopsis
Package main
Package main

Jump to

Keyboard shortcuts

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