Skip to content

Commit

Permalink
feat: default to mod's version
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyoucao577 committed Apr 20, 2024
1 parent 96af9f0 commit ab30c76
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion util/appversion/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ func (v versionInfo) print(w io.Writer) {
func Print() {
if buildInfo, ok := debug.ReadBuildInfo(); ok {
var v versionInfo
v.AppVersion = buildInfo.Main.Version // default to mod's version

for _, s := range buildInfo.Settings {
switch s.Key {
case "-tags":
v.AppVersion = s.Value
if v.AppVersion != "" { // update with -tags if doesn't exist
v.AppVersion = s.Value
}
case "vcs.revision":
v.GitRevision = s.Value
case "vcs.time":
Expand Down

0 comments on commit ab30c76

Please sign in to comment.