version

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

README

SunnyVersion 工具

使用方法

###只要在 import里面添加这一句就可以

_ "github.com/sunnyregion/util/version"
Makefile
BUILD_NAME      := appRun          # _$(shell date "+%Y%m%d%H" )
BUILD_VERSION   := V1.0.1.9-$(shell date "+%Y%m%d")
BUILD_TIME      := $(shell date "+%F %T")
SOURCE          := main.go
TARGET_DIR      := ./
GIT_ID           := $(shell git rev-parse HEAD )
GO_VERSION      := $(shell go version)
GIT_BRANCH	:= $(shell git symbolic-ref --short -q HEAD)
EMOJI           := _| ̄|○ -----🎉🎉🎉👍💁👌huizhi api⚽🎍😍🎉🎉🎉------○| ̄|_


all:
	# CGO_ENABLED=0 GOOS=linux GOARCH=amd64
	CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags  \
		" \
		-X 'github.com/sunnyregion/util/version.VERSION=${BUILD_VERSION}' \
		-X 'github.com/sunnyregion/util/version.BuildTime=${BUILD_TIME}' \
		-X 'github.com/sunnyregion/util/version.BuildName=${BUILD_NAME}'  \
		-X 'github.com/sunnyregion/util/version.GitID=${GIT_ID}' \
		-X 'github.com/sunnyregion/util/version.GitBranch=${GIT_BRANCH}' \
		-X 'github.com/sunnyregion/util/version.GoVersion=${GO_VERSION}' \
		-X 'github.com/sunnyregion/util/version.EMOJI=${EMOJI}' \
		" \

    -o ${BUILD_NAME} ${SOURCE}

clean:
	rm ${BUILD_NAME} -f

install:
	mkdir -p ${TARGET_DIR}
	cp ${BUILD_NAME} ${TARGET_DIR} -f

.PHONY : all clean install ${BUILD_NAME}


编译

make

install

make install

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//VERSION  版本信息
	VERSION string
	//BuildTime 创建时间
	BuildTime string
	//BuildName build的名字
	BuildName string
	//GitID git版本
	GitID string
	//GoVersion 版本
	GoVersion string
	//EMOJI 表情
	EMOJI string
	//GitBranch 版本分支
	GitBranch string
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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