File tree Expand file tree Collapse file tree 3 files changed +7
-15
lines changed
Expand file tree Collapse file tree 3 files changed +7
-15
lines changed Original file line number Diff line number Diff line change 11OUT_DIR := ./out
22GO_FILES := $(shell find . -type f \( -iname '* .go' \) )
33
4- PBCLI_BUILD_VERSION ?= $(shell git describe --tags)
5- ifeq ($(PBCLI_BUILD_VERSION ) ,)
6- _ := $(error Cannot determine build version)
7- endif
8-
9- BUILD_VERSION_FLAG := github.com/pushbits/cli/internal/buildconfig.Version=$(PBCLI_BUILD_VERSION )
10-
114.PHONY : build
125build :
136 mkdir -p $(OUT_DIR )
14- go build -ldflags " -w -s -X $( BUILD_VERSION_FLAG ) " -o $(OUT_DIR ) /pbcli ./cmd/pbcli
7+ go build -ldflags " -w -s" -o $(OUT_DIR ) /pbcli ./cmd/pbcli
158
169.PHONY : clean
1710clean :
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ package commands
33
44import (
55 "fmt"
6+ "runtime/debug"
67
7- "github.com/pushbits/cli/internal/buildconfig"
88 "github.com/pushbits/cli/internal/options"
99)
1010
@@ -13,7 +13,11 @@ type VersionCommand struct{}
1313
1414// Run is the function for the version command.
1515func (* VersionCommand ) Run (_ * options.Options ) error {
16- fmt .Printf ("pbcli %s\n " , buildconfig .Version )
16+ buildInfo , ok := debug .ReadBuildInfo ()
17+ if ! ok {
18+ return fmt .Errorf ("build info not available" )
19+ }
1720
21+ fmt .Printf ("pbcli %s\n " , buildInfo .Main .Version )
1822 return nil
1923}
You can’t perform that action at this time.
0 commit comments