diff --git a/build.sh b/build.sh index 326a621..09ed5fc 100755 --- a/build.sh +++ b/build.sh @@ -143,7 +143,7 @@ for GOOS in "${GOOSES[@]}"; do fi FILENAME="${NAME}_${RELEASE}_${GOOS}_${GOARCH}${SUFFIX}" echo building "${FILENAME}" - GOOS=${GOOS} GOARCH=${GOARCH} CGO_ENABLED=0 go build -o "${FILENAME}" + GOOS=${GOOS} GOARCH=${GOARCH} CGO_ENABLED=0 go build -o "${FILENAME}" -ldflags "-X main.version=${RELEASE}" done done diff --git a/main.go b/main.go index eb4f9dc..176fb55 100644 --- a/main.go +++ b/main.go @@ -10,9 +10,10 @@ import ( "github.com/nathanejohnson/whichca/cmd" ) +var version = "" + func main() { log := logpkg.New(os.Stdout, "", 0) - version := "" bi, ok := debug.ReadBuildInfo() if ok { version = bi.Main.Version