diff --git a/cmd/gost/program.go b/cmd/gost/program.go index 9591485..1ad4ccd 100644 --- a/cmd/gost/program.go +++ b/cmd/gost/program.go @@ -152,8 +152,13 @@ func (p *program) Start() error { cfg := config.Global() if showConfig { - marshal, _ := yaml.Marshal(cfg) - fmt.Println(string(marshal)) + if outputFormat == "json" { + marshal, _ := json.Marshal(cfg) + fmt.Println(string(marshal)) + } else { + marshal, _ := yaml.Marshal(cfg) + fmt.Println(string(marshal)) + } os.Exit(0) return nil }