Skip to content

Commit

Permalink
fix: modify not to use debug.ReadBuildInfo()
Browse files Browse the repository at this point in the history
  • Loading branch information
taxintt committed Aug 1, 2023
1 parent c99a4d1 commit 50f2e9a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package cmd
import (
"fmt"
"runtime"
"runtime/debug"

"github.com/spf13/cobra"
)

var Version string = ""
var (
Version string
)

func getVersion(version string) string {
return fmt.Sprintf(`tagli
Expand All @@ -21,11 +22,6 @@ Arch: %s`, version, runtime.GOOS, runtime.GOARCH)
var versionCmd = &cobra.Command{
Use: "version",
Run: func(cmd *cobra.Command, args []string) {
info, ok := debug.ReadBuildInfo()
if !ok {
Version = "unknown"
}
Version = info.Main.Version
fmt.Println(getVersion(Version))
},
Short: "Show cli version info",
Expand Down

0 comments on commit 50f2e9a

Please sign in to comment.