Skip to content

Commit

Permalink
read version from buildinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
r33drichards committed Oct 29, 2021
1 parent b8503e2 commit 776ea5f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/cmd/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package version

import (
"fmt"
"runtime/debug"

"github.com/fatih/color"

Expand Down Expand Up @@ -44,7 +45,13 @@ type githubReleaseMetadata struct {
}

func BuildVersionString(t *terminal.Terminal) (string, error) {
currentVersion := config.GlobalConfig.GetVersion()
info, ok := debug.ReadBuildInfo()
var currentVersion string
if ok {
currentVersion = info.Main.Version
} else {
currentVersion = config.GlobalConfig.GetVersion()
}

githubRelease, err := getLatestGithubReleaseMetadata()
if err != nil {
Expand Down

0 comments on commit 776ea5f

Please sign in to comment.