Skip to content

Commit

Permalink
PMM-12997 Fix pmm-agent --json output. (#2897)
Browse files Browse the repository at this point in the history
(cherry picked from commit f8f1329)
  • Loading branch information
BupycHuk committed Mar 19, 2024
1 parent 9d520d6 commit 10aa17a
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 10aa17a

Please sign in to comment.