Change -X main.Version <n> to -X main.Version=<n> for go1.5

This commit is contained in:
Cameron Sparr 2015-08-20 08:46:08 -06:00
parent 601b444a60
commit 9bc39987f1
4 changed files with 4 additions and 4 deletions

View File

@ -3,7 +3,7 @@ VERSION := $(shell sh -c 'git describe --always --tags')
build: prepare build: prepare
$(GOPATH)/bin/godep go build -o telegraf -ldflags \ $(GOPATH)/bin/godep go build -o telegraf -ldflags \
"-X main.Version $(VERSION)" \ "-X main.Version=$(VERSION)" \
./cmd/telegraf/telegraf.go ./cmd/telegraf/telegraf.go
prepare: prepare:

View File

@ -25,7 +25,7 @@ function exit_if_fail {
function build { function build {
echo -n "=> $1-$2: " echo -n "=> $1-$2: "
GOOS=$1 GOARCH=$2 godep go build -o telegraf-$1-$2 \ GOOS=$1 GOARCH=$2 godep go build -o telegraf-$1-$2 \
-ldflags "-X main.Version $3" \ -ldflags "-X main.Version=$3" \
./cmd/telegraf/telegraf.go ./cmd/telegraf/telegraf.go
du -h telegraf-$1-$2 du -h telegraf-$1-$2
} }

View File

@ -22,7 +22,7 @@ var fPidfile = flag.String("pidfile", "", "file to write our pid to")
var fPLuginsFilter = flag.String("filter", "", "filter the plugins to enable, separator is :") var fPLuginsFilter = flag.String("filter", "", "filter the plugins to enable, separator is :")
// Telegraf version // Telegraf version
// -ldflags "-X main.Version `git describe --always --tags`" // -ldflags "-X main.Version=`git describe --always --tags`"
var Version string var Version string
func main() { func main() {

View File

@ -141,7 +141,7 @@ do_build() {
rm -f $GOPATH_INSTALL/bin/$b rm -f $GOPATH_INSTALL/bin/$b
done done
godep go install -a -ldflags="-X main.Version $version" ./... godep go install -a -ldflags="-X main.Version=$version" ./...
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Build failed, unable to create package -- aborting" echo "Build failed, unable to create package -- aborting"
cleanup_exit 1 cleanup_exit 1