Skip to content

Commit

Permalink
Fix version output.
Browse files Browse the repository at this point in the history
  • Loading branch information
pehlicd committed Sep 10, 2023
1 parent 7eca249 commit c3741c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ builds:
binary: amtui
env:
- CGO_ENABLED=0
ldflags: -s -w -X pkg.versionString={{.Tag}}
ldflags: -s -w -X github.com/pehlicd/amtui/pkg.versionString={{ .Tag }} -X github.com/pehlicd/amtui/pkg.buildDate={{ .Date }} -X github.com/pehlicd/amtui/pkg.buildCommit={{ .Commit }}
goos:
- linux
- darwin
Expand Down
18 changes: 9 additions & 9 deletions pkg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ Options:
)

var (
versionString string
fl = flag.NewFlagSet("amtui", flag.ExitOnError)
host = fl.String("host", "localhost", "Alertmanager host")
port = fl.StringP("port", "p", "9093", "Alertmanager port")
insecure = fl.BoolP("insecure", "i", true, "For insecurely connecting to Alertmanager")
help = fl.BoolP("help", "h", false, "Show help")
version = fl.BoolP("version", "v", false, "Show version")
scheme = "http"
versionString, buildDate, buildCommit string
fl = flag.NewFlagSet("amtui", flag.ExitOnError)
host = fl.String("host", "localhost", "Alertmanager host")
port = fl.StringP("port", "p", "9093", "Alertmanager port")
insecure = fl.BoolP("insecure", "i", true, "For insecurely connecting to Alertmanager")
help = fl.BoolP("help", "h", false, "Show help")
version = fl.BoolP("version", "v", false, "Show version")
scheme = "http"
)

func printHelp(w io.Writer) {
Expand Down Expand Up @@ -75,7 +75,7 @@ func initConfig() Config {
}

if *version {
fmt.Printf("amtui version: v%s\n", versionString)
fmt.Printf("Version: %s\nBuild Date: %s\nBuild Commit: %s\n", versionString, buildDate, buildCommit)
os.Exit(0)
}

Expand Down

0 comments on commit c3741c8

Please sign in to comment.