Skip to content

Commit

Permalink
Use the version info set by goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
laenzlinger committed Mar 31, 2024
1 parent 22d062a commit ab54b7c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ var rootCmd = &cobra.Command{

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
func Execute(version string) {
rootCmd.Version = version

err := rootCmd.Execute()
if err != nil {
os.Exit(1)
Expand Down
15 changes: 13 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package main

import "github.com/laenzlinger/setlist/cmd"
import (
"fmt"

"github.com/laenzlinger/setlist/cmd"
)

var (
version = "dev"
commit = "none" //nolint:gochecknoglobals // set by ldflag
date = "unknown" //nolint:gochecknoglobals // set by ldflag

)

func main() {
cmd.Execute()
cmd.Execute(fmt.Sprintf("%s commit %s (%s) ", version, commit, date))
}

0 comments on commit ab54b7c

Please sign in to comment.