From 5732ce5dfa86204dab98ff8239bb1bce4f92fd1e Mon Sep 17 00:00:00 2001 From: Eugene Dementiev Date: Tue, 17 Apr 2018 11:08:44 +1200 Subject: [PATCH] Add version var to use with goreleaser --- cmd/root.go | 6 ++---- main.go | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index f81a845..7b7ba49 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -12,7 +12,6 @@ var ( names []string recursive bool strict bool - Version = "dev" ) // rootCmd represents the base command when called without any subcommands @@ -24,11 +23,10 @@ var rootCmd = &cobra.Command{ It gets specified parameters (possibly secret) from AWS SSM Parameter Store, then exports them to the underlying process. `, - Version: Version, - // Run: func(cmd *cobra.Command, args []string) {}, } -func Execute() { +func Execute(version string) { + rootCmd.Version = version if err := rootCmd.Execute(); err != nil { fmt.Println(err) os.Exit(1) diff --git a/main.go b/main.go index 504b10b..4ecbdb4 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,8 @@ package main import "github.com/springload/ssm-parent/cmd" +var version = "dev" + func main() { - cmd.Execute() + cmd.Execute(version) }