From c4e4518d04824318c1420f0870cfd1ce9ba9e0b4 Mon Sep 17 00:00:00 2001 From: Diogo Monica Date: Tue, 28 Jul 2015 14:18:34 -0700 Subject: [PATCH] Adding version from version.go Signed-off-by: Diogo Monica --- cmd/notary/main.go | 3 ++- version/print.go | 26 -------------------------- version/version.go | 12 ++++-------- version/version.sh | 22 ---------------------- 4 files changed, 6 insertions(+), 57 deletions(-) delete mode 100644 version/print.go delete mode 100644 version/version.sh diff --git a/cmd/notary/main.go b/cmd/notary/main.go index eb1535426d..7a3da8f0c7 100644 --- a/cmd/notary/main.go +++ b/cmd/notary/main.go @@ -11,6 +11,7 @@ import ( "github.com/spf13/viper" "github.com/docker/notary/pkg/passphrase" + "github.com/docker/notary/version" ) const configFileName string = "config" @@ -80,7 +81,7 @@ func main() { Short: "Print the version number of notary", Long: `print the version number of notary`, Run: func(cmd *cobra.Command, args []string) { - fmt.Println("notary v0.1.0-rc1") + fmt.Printf("notary\n Version: %s\n Git commit: %s\n", version.NotaryVersion, version.GitCommit) }, } diff --git a/version/print.go b/version/print.go deleted file mode 100644 index 7abf8916e6..0000000000 --- a/version/print.go +++ /dev/null @@ -1,26 +0,0 @@ -package version - -import ( - "fmt" - "io" - "os" -) - -// FprintVersion outputs the version string to the writer, in the following -// format, followed by a newline: -// -// -// -// For example, a binary "registry" built from github.com/docker/distribution -// with version "v2.0" would print the following: -// -// registry github.com/docker/distribution v2.0 -// -func FprintVersion(w io.Writer) { - fmt.Fprintln(w, os.Args[0], Package, Version) -} - -// PrintVersion outputs the version information, from Fprint, to stdout. -func PrintVersion() { - FprintVersion(os.Stdout) -} diff --git a/version/version.go b/version/version.go index 2f177c8081..7cff7ad078 100644 --- a/version/version.go +++ b/version/version.go @@ -1,11 +1,7 @@ package version -// Package is the overall, canonical project import path under which the -// package was built. -var Package = "github.com/docker/notary" +// Version indicates which version of the binary is running. +var NotaryVersion = "v0.1.0-rc1" -// Version indicates which version of the binary is running. This is set to -// the latest release tag by hand, always suffixed by "+unknown". During -// build, it will be replaced by the actual version. The value here will be -// used if the registry is run after a go get based install. -var Version = "v0.0.1-alpha.1+unknown" +// GitCommit indicates which git hash the binary was built off of +var GitCommit string diff --git a/version/version.sh b/version/version.sh deleted file mode 100644 index e28a5f1cc3..0000000000 --- a/version/version.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# This bash script outputs the current, desired content of version.go, using -# git describe. For best effect, pipe this to the target file. Generally, this -# only needs to updated for releases. The actual value of will be replaced -# during build time if the makefile is used. - -set -e - -cat <