diff options
author | Ruben Pollan <meskio@sindominio.net> | 2018-06-04 17:40:56 +0200 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2018-06-04 19:01:11 +0200 |
commit | 67e258a7a2217300a43c8aa0636bfe4d4aef6bdb (patch) | |
tree | b6b732b7cffa05d33f9622f5e56dba7409bb705c | |
parent | 715850857759d49dbb7d9ffb93acb9435a8b3136 (diff) |
[feat] add version string
The binary now has a --version that is extracted from the git
tags/commits.
- Resolves: #39
-rw-r--r-- | .gitlab-ci.yml | 2 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | main.go | 10 |
3 files changed, 13 insertions, 3 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9da446b..d72274a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,7 +17,7 @@ build_test: - cd ${APP_PATH} - go get . - go test ./... - - go build + - make build tags: - linux artifacts: @@ -2,8 +2,8 @@ all: icon locales build -build: icon catalog.go - go build +build: + go build -ldflags "-X main.version=`git describe --tags`" clean: make -C icon clean @@ -16,6 +16,8 @@ package main import ( + "flag" + "fmt" "log" "os" @@ -29,9 +31,17 @@ const ( applicationName = "RiseupVPN" ) +var version string var printer *message.Printer func main() { + versionFlag := flag.Bool("version", false, "Version of the bitmask-systray") + flag.Parse() + if *versionFlag { + fmt.Println(version) + os.Exit(0) + } + if _, err := os.Stat(bitmask.ConfigPath); os.IsNotExist(err) { os.MkdirAll(bitmask.ConfigPath, os.ModePerm) } |