Skip to content

Commit

Permalink
move main and read build info
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard87 committed Mar 11, 2024
1 parent 8f0dd69 commit cddf0af
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/vendor/*
debug
radix-cli
rx
rx-test
/rx
/rx-test
.idea/
.dccache
File renamed without changes.
9 changes: 9 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime/debug"
"strings"
"time"

Expand Down Expand Up @@ -38,6 +39,14 @@ func Execute() {
}
}

func init() {
if Version == "dev" {
if info, ok := debug.ReadBuildInfo(); ok {
Version = info.Main.Version
}
}
}

func setVerbosePersistentFlag(cmd *cobra.Command) *bool {
return cmd.PersistentFlags().Bool(flagnames.Verbose, false, "Verbose output")
}
Expand Down

0 comments on commit cddf0af

Please sign in to comment.