build: set build version in binary at build time

This commit is contained in:
mappu 2017-02-06 16:43:17 +13:00
parent 1d3f16e6c6
commit 761d0bfad5
2 changed files with 2 additions and 4 deletions

View File

@ -88,7 +88,7 @@ single_build() {
# GOARCH/GOOS supplied in function env # GOARCH/GOOS supplied in function env
go build \ go build \
-a \ -a \
-ldflags '-s -w' \ -ldflags "-s -w -X main.VERSION=nmdc-webfrontend/${version}" \
-gcflags "-trimpath=${GOPATH}" \ -gcflags "-trimpath=${GOPATH}" \
-asmflags "-trimpath=${GOPATH}" \ -asmflags "-trimpath=${GOPATH}" \
-o "$(pathfix "${tmpdir}/${local_bin_name}")" -o "$(pathfix "${tmpdir}/${local_bin_name}")"

View File

@ -12,9 +12,7 @@ import (
"github.com/googollee/go-socket.io" "github.com/googollee/go-socket.io"
) )
const ( var VERSION string = `nmdc-webfrontend/devel-unreleased`
VERSION = `nmdc-webfrontend/1.1.2`
)
type App struct { type App struct {
cfg *Config cfg *Config