From daf36c40e69119e48d399dc8c7bf7fda229c1433 Mon Sep 17 00:00:00 2001 From: "Frederick F. Kautz IV" Date: Fri, 24 Apr 2015 19:48:51 -0700 Subject: [PATCH] Version number now set through ldflags in makefile --- Makefile | 2 +- build-constants.go | 9 --------- globals.go | 4 +--- main.go | 6 +++++- 4 files changed, 7 insertions(+), 14 deletions(-) delete mode 100644 build-constants.go diff --git a/Makefile b/Makefile index 7ae51349..a9a573c6 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,7 @@ env: install: test-all @echo "Installing mc:" - @godep go install -a github.com/minio-io/mc + @godep go install -ldflags "-X main.Version `git rev-parse HEAD`" github.com/minio-io/mc @mkdir -p $(HOME)/.mc clean: diff --git a/build-constants.go b/build-constants.go deleted file mode 100644 index b23a632a..00000000 --- a/build-constants.go +++ /dev/null @@ -1,9 +0,0 @@ -/* - * ** DO NOT EDIT THIS FILE. THIS FILE IS AUTO POPULATED BY GIT ** - */ - -package main - -const ( - mcGitCommitHash = "$Id$" -) diff --git a/globals.go b/globals.go index 31806f4b..ce2212e4 100644 --- a/globals.go +++ b/globals.go @@ -20,7 +20,6 @@ package main import ( "os" "runtime" - "strings" ) var ( @@ -29,6 +28,5 @@ var ( globalMaxRetryFlag = 5 // Maximum number of retries mcUserAgent = "Minio/" + - strings.SplitN(mcGitCommitHash, " ", 3)[1] + - " (" + os.Args[0] + "; " + runtime.GOOS + "; " + runtime.GOARCH + ")" + Version + " (" + os.Args[0] + "; " + runtime.GOOS + "; " + runtime.GOARCH + ")" ) diff --git a/main.go b/main.go index 386d2b05..1b85e266 100644 --- a/main.go +++ b/main.go @@ -78,10 +78,14 @@ func getSystemData() map[string]string { } } +// Version number +var Version = "Development" + func main() { app := cli.NewApp() app.Usage = "Mini Copy for object storage and filesystems" - app.Version = mcGitCommitHash + log.Println(Version) + app.Version = Version app.Commands = options app.Flags = flags app.Author = "Minio.io"