diff --git a/cmd/shadowsocks-go-domain-set-converter/main.go b/cmd/shadowsocks-go-domain-set-converter/main.go index c84a1be..431a03c 100644 --- a/cmd/shadowsocks-go-domain-set-converter/main.go +++ b/cmd/shadowsocks-go-domain-set-converter/main.go @@ -54,41 +54,41 @@ func main() { } if inCount != 1 { - fmt.Println("Exactly one of -inDlc, -inText, -inGob must be specified.") + fmt.Fprintln(os.Stderr, "Exactly one of -inDlc, -inText, -inGob must be specified.") flag.Usage() os.Exit(1) } if *outText == "" && *outGob == "" { - fmt.Println("Specify output file paths with -outText and/or -outGob.") + fmt.Fprintln(os.Stderr, "Specify output file paths with -outText and/or -outGob.") flag.Usage() os.Exit(1) } data, err := mmap.ReadFile[string](inPath) if err != nil { - fmt.Println(err) + fmt.Fprintln(os.Stderr, "Failed to read input file:", err) os.Exit(1) } defer mmap.Unmap(data) dsb, err := inFunc(data) if err != nil { - fmt.Println(err) + fmt.Fprintln(os.Stderr, "Failed to parse input file:", err) return } if *outText != "" { fout, err := os.Create(*outText) if err != nil { - fmt.Println(err) + fmt.Fprintln(os.Stderr, "Failed to create output file:", err) return } defer fout.Close() err = dsb.WriteText(fout) if err != nil { - fmt.Println(err) + fmt.Fprintln(os.Stderr, "Failed to write output file:", err) return } } @@ -96,14 +96,14 @@ func main() { if *outGob != "" { fout, err := os.Create(*outGob) if err != nil { - fmt.Println(err) + fmt.Fprintln(os.Stderr, "Failed to create output file:", err) return } defer fout.Close() err = dsb.WriteGob(fout) if err != nil { - fmt.Println(err) + fmt.Fprintln(os.Stderr, "Failed to write output file:", err) return } } diff --git a/cmd/shadowsocks-go/main.go b/cmd/shadowsocks-go/main.go index 349cf6b..48a706f 100644 --- a/cmd/shadowsocks-go/main.go +++ b/cmd/shadowsocks-go/main.go @@ -33,7 +33,7 @@ func main() { flag.Parse() if confPath == "" { - fmt.Println("Missing -confPath .") + fmt.Fprintln(os.Stderr, "Missing -confPath .") flag.Usage() os.Exit(1) } @@ -54,7 +54,7 @@ func main() { zc = zap.NewDevelopmentConfig() default: if err := jsonhelper.LoadAndDecodeDisallowUnknownFields(zapConf, &zc); err != nil { - fmt.Println(err) + fmt.Fprintln(os.Stderr, "Failed to load zap logger config:", err) os.Exit(1) } } @@ -65,7 +65,7 @@ func main() { logger, err := zc.Build() if err != nil { - fmt.Println(err) + fmt.Fprintln(os.Stderr, "Failed to build logger:", err) os.Exit(1) } defer logger.Sync()