From 4ef9a7ab97f2e831dddd401cc6d7432af3bfa844 Mon Sep 17 00:00:00 2001 From: Fabrizio Steiner Date: Wed, 27 Dec 2017 19:15:50 +0100 Subject: [PATCH] Fix the version information output. Additionally output the commit hash and the build date. --- goreleaser.yml | 4 ---- main.go | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/goreleaser.yml b/goreleaser.yml index 1fd04fc..4757aac 100644 --- a/goreleaser.yml +++ b/goreleaser.yml @@ -4,10 +4,6 @@ build: # Default is `main.go` main: ./main.go - # Custom ldflags. - # Default is `-s -w` - ldflags: -s -w - # GOOS list to build in. # For more info refer to https://golang.org/doc/install/source#environment # Defaults are darwin and linux diff --git a/main.go b/main.go index bf9bd21..89a7f5f 100644 --- a/main.go +++ b/main.go @@ -21,6 +21,8 @@ import ( const DockerAPIMinVersion string = "1.24" var version = "master" +var commit = "unknown" +var date = "unknown" var ( client container.Client @@ -37,7 +39,7 @@ func init() { func main() { app := cli.NewApp() app.Name = "watchtower" - app.Version = version + app.Version = version + " - " + commit + " - " + date app.Usage = "Automatically update running Docker containers" app.Before = before app.Action = start