Skip to content

Commit 5cc9428

Browse files
authored
Print right version when installed via "go install" (#349)
Currently when install with `go install github.com/roborev-dev/roborev/cmd/roborev@latest`, running `roborev version` prints `dev`. This PR changes that to take version info from debug info.
1 parent 417819f commit 5cc9428

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

internal/version/version.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ func getVersionFromVCS() string {
2626
return "dev"
2727
}
2828

29+
// Use module version when installed via `go install pkg@version`
30+
if v := info.Main.Version; v != "" && v != "(devel)" {
31+
return v
32+
}
33+
2934
var revision string
3035
var modified bool
3136

0 commit comments

Comments
 (0)