Skip to content

Commit

Permalink
PMM-12997 Fix pmm-agent --json output.
Browse files Browse the repository at this point in the history
  • Loading branch information
BupycHuk committed Mar 13, 2024
1 parent d915d37 commit d8f54d0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions agent/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package config
import (
"fmt"
"io/fs"
"log"
"net"
"net/url"
"os"
Expand Down Expand Up @@ -414,10 +413,11 @@ func Application(cfg *Config) (*kingpin.Application, *string) {
}).Bool()

app.Flag("version", "Show application version").Short('v').Action(func(*kingpin.ParseContext) error {
// We use fmt instead of log package to provide proper output for --json flag.
if *jsonF {
log.Println(version.FullInfoJSON())
fmt.Println(version.FullInfoJSON()) //nolint:forbidigo
} else {
log.Println(version.FullInfo())
fmt.Println(version.FullInfo()) //nolint:forbidigo
}
os.Exit(0)

Expand Down

0 comments on commit d8f54d0

Please sign in to comment.