diff --git a/Makefile b/Makefile index c8c1c03..a218bd2 100644 --- a/Makefile +++ b/Makefile @@ -3,14 +3,14 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. NAME := pistol -VERSION := v0.1 (2020-04-17) (breaking release, see README) -version := $(word 1, $(VERSION)) +VERSION := v0.1.1 (2020-04-17) (breaking release, see README) +# version := $(word 1, $(VERSION)) build: - go build -ldflags "-X 'main.VERSION=$(VERSION)'" ./cmd/pistol + go build -ldflags "-X 'main.Version=$(VERSION)'" ./cmd/pistol install: - go install -ldflags "-X 'main.VERSION=$(VERSION)'" ./cmd/pistol + go install -ldflags "-X 'main.Version=$(VERSION)'" ./cmd/pistol # requires: bat (https://github.com/sharkdp/bat), elinks test: pistol diff --git a/cmd/pistol/main.go b/cmd/pistol/main.go index e23754b..0815176 100644 --- a/cmd/pistol/main.go +++ b/cmd/pistol/main.go @@ -3,6 +3,7 @@ package main import ( "os" "log" + "fmt" "github.com/doronbehar/pistol" "github.com/galdor/go-cmdline" @@ -10,7 +11,7 @@ import ( ) var ( - VERSION string + Version string ) func main() { @@ -26,7 +27,7 @@ func main() { cmd.Parse(os.Args) if cmd.IsOptionSet("version") { - print(VERSION, "\n") + fmt.Println(Version) os.Exit(0) }