From 113a256e7f3ee98e8ea24deb51d829a50b607596 Mon Sep 17 00:00:00 2001 From: Eugene Kalinin Date: Wed, 22 Jul 2020 01:19:24 +0300 Subject: [PATCH] root: use version variable (will be set by goreleaser) --- cmd/const.go | 6 ++++++ cmd/root.go | 23 +---------------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/cmd/const.go b/cmd/const.go index 23438d1..5fc5a3c 100644 --- a/cmd/const.go +++ b/cmd/const.go @@ -6,3 +6,9 @@ const ( pbName = "pbvm" pbDateFormat = "2006.01.02" ) + +// Version will be set by goreleaser (see .goreleaser.yml) +var pbVersion string + +// Commit will be set by goreleaser (see .goreleaser.yml) +var pbCommit string diff --git a/cmd/root.go b/cmd/root.go index 3749840..7234e36 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -1,24 +1,3 @@ -/* -Copyright © 2020 Eugene Kalinin - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ package cmd import ( @@ -42,7 +21,7 @@ var rootCmd = &cobra.Command{ Use: pbName, Short: "Protocol Buffers Version Manager", Long: `It is a CLI tool for easy install/switch any versions of the Protocol Buffers.`, - Version: "0.0.1", + Version: pbVersion + "@" + pbCommit, } // Execute adds all child commands to the root command and sets flags appropriately.