Added -version flag to watchdog

This changes introduces a new flag -version to watchdog which will
display version and SHA of last git commit.

Version and SHA are injected at build time and passed as a
build-args for Dockerfile.

Fixes: #632

Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
This commit is contained in:
Vivek Singh
2018-04-14 15:29:01 +05:30
committed by Alex Ellis
parent f936dcd757
commit c258637d6d
4 changed files with 57 additions and 7 deletions

18
watchdog/version.go Normal file
View File

@ -0,0 +1,18 @@
package main
var (
//Version release version of the watchdog
Version string
//GitCommit SHA of the last git commit
GitCommit string
//DevVerison string for the development version
DevVerison = "dev"
)
//BuildVersion returns current version of watchdog
func BuildVersion() string {
if len(Version) == 0 {
return DevVerison
}
return Version
}