1 Star 0 Fork 73

YangMain/SOAR

forked from Gitee 极速下载/SOAR 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
genver.sh 1.26 KB
一键复制 编辑 原始数据 按行查看 历史
Leon Zhang 提交于 2018-11-12 23:31 . update version info in Makefile
#!/bin/bash
## Go version check
GO_VERSION_MIN=$1
echo "==> Checking that build is using go version >= ${GO_VERSION_MIN}..."
GO_VERSION=$(go version | grep -o 'go[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?' | tr -d 'go')
IFS="." read -r -a GO_VERSION_ARR <<<"$GO_VERSION"
IFS="." read -r -a GO_VERSION_REQ <<<"$GO_VERSION_MIN"
if [[ ${GO_VERSION_ARR[0]} -lt ${GO_VERSION_REQ[0]} || (${GO_VERSION_ARR[0]} -eq ${GO_VERSION_REQ[0]} && (${GO_VERSION_ARR[1]} -lt ${GO_VERSION_REQ[1]} || (${GO_VERSION_ARR[1]} -eq ${GO_VERSION_REQ[1]} && ${GO_VERSION_ARR[2]} -lt ${GO_VERSION_REQ[2]}))) ]] \
; then
echo "requires go $GO_VERSION_MIN to build; found $GO_VERSION."
exit 1
fi
## Generate Repository Version
version="$(git log --date=iso --pretty=format:"%cd" -1) $(git describe --tags --always)"
if [ "X${version}" == "X" ]; then
version="not a git repo"
fi
git_dirty=$(git diff --no-ext-diff 2>/dev/null | wc -l)
compile="$(date +"%F %T %z") by $(go version)"
branch=$(git rev-parse --abbrev-ref HEAD)
dev_path=$(
cd "$(dirname "$0")" || exit
pwd
)
cat <<EOF | gofmt >common/version.go
package common
// -version输出信息
const (
Version = "${version}"
Compile = "${compile}"
Branch = "${branch}"
GitDirty= ${git_dirty}
DevPath = "${dev_path}"
)
EOF
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yangmain/SOAR.git
git@gitee.com:yangmain/SOAR.git
yangmain
SOAR
SOAR
master

搜索帮助