build: fix scripts/dist.sh

* get OSS version from version/version.go
* fix indenting to two spaces
pull/3430/head
Frank Schroeder 2017-08-30 13:36:05 +02:00 committed by Frank Schröder
parent f25632d6a1
commit 5ded0fbf4e
1 changed files with 13 additions and 9 deletions

View File

@ -4,8 +4,12 @@ set -e
# Get the version from the environment, or try to figure it out from the build tags.
# We process the files in the same order Go does to find the last matching tag.
if [ -z $VERSION ]; then
for file in $(ls version/version_*.go | sort); do
# get the OSS version from version.go
VERSION=$(awk -F\" '/Version =/ { print $2; exit }' <version/version.go)
# if we have build tags then try to determine the version
for tag in "$GOTAGS"; do
for file in $(ls version/version_*.go | sort); do
if grep -q "// +build $tag" $file; then
VERSION=$(awk -F\" '/Version =/ { print $2; exit }' <$file)
fi