From 6f40e0766d022121491311021b957de05bf580f1 Mon Sep 17 00:00:00 2001 From: meiji163 Date: Thu, 19 Dec 2024 20:34:40 -0800 Subject: [PATCH] set ldflags in build --- script/build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/build b/script/build index 24be5d17f..9d56ca7c3 100755 --- a/script/build +++ b/script/build @@ -10,11 +10,11 @@ scriptdir="$PWD"/script # We have a few binaries that we want to build, so let's put them into bin/ -version=$(git rev-parse HEAD) -describe=$(git describe --tags --always --dirty) +RELEASE_VERSION=$(git describe --abbrev=0 --tags | tr -d 'v') +GIT_COMMIT=$(git rev-parse HEAD) export GOPATH="$PWD/.gopath" cd .gopath/src/github.com/github/gh-ost # We put the binaries directly into the bindir, because we have no need for shim wrappers -go build -o "$bindir/gh-ost" -ldflags "-X main.AppVersion=${version} -X main.BuildDescribe=${describe}" ./go/cmd/gh-ost/main.go +go build -o "$bindir/gh-ost" -ldflags "-X main.AppVersion=${RELEASE_VERSION} -X main.GitCommit=${GIT_COMMIT}" ./go/cmd/gh-ost/main.go