From 6c20033bcc96f3d0abffc54e71c5c38f7ea611eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Mon, 12 Apr 2021 08:58:39 +0200 Subject: [PATCH] Add func to return full version string --- cmd/apiary.go | 2 +- version.go | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/apiary.go b/cmd/apiary.go index bdb01ba..3e347d9 100644 --- a/cmd/apiary.go +++ b/cmd/apiary.go @@ -23,7 +23,7 @@ import ( func main() { app := &cli.App{ Name: "apiary", - Version: apiary.Version, + Version: apiary.FullVersion(), Authors: []*cli.Author{ { Name: "Torjus HÃ¥kestad", diff --git a/version.go b/version.go index 24d443e..71ba5ba 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,14 @@ package apiary +import "fmt" + var Version = "v0.1.1" var Build string + +func FullVersion() string { + if Build != "" { + return fmt.Sprintf("%s-%s", Version, Build) + } + + return Version +}