diff --git a/cmd/bench/main.go b/cmd/bench/main.go index 4a4880ff07e..3b3fb01e8a5 100644 --- a/cmd/bench/main.go +++ b/cmd/bench/main.go @@ -152,5 +152,8 @@ func buildCLI() *cli.App { func main() { app := buildCLI() - app.Run(os.Args) + if err := app.Run(os.Args); err != nil { + _, _ = fmt.Fprintln(app.ErrWriter, err) + os.Exit(1) + } } diff --git a/cmd/canary/main.go b/cmd/canary/main.go index fa6a2632235..cdbf89e94ef 100644 --- a/cmd/canary/main.go +++ b/cmd/canary/main.go @@ -147,5 +147,8 @@ func buildCLI() *cli.App { func main() { app := buildCLI() - app.Run(os.Args) + if err := app.Run(os.Args); err != nil { + _, _ = fmt.Fprintln(app.ErrWriter, err) + os.Exit(1) + } } diff --git a/cmd/server/main.go b/cmd/server/main.go index 6af56db5862..545515599a0 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -21,6 +21,7 @@ package main import ( + "fmt" "os" "github.com/uber/cadence/cmd/server/cadence" @@ -37,5 +38,8 @@ import ( // main entry point for the cadence server func main() { app := cadence.BuildCLI(metrics.ReleaseVersion, metrics.Revision) - app.Run(os.Args) + if err := app.Run(os.Args); err != nil { + _, _ = fmt.Fprintln(app.ErrWriter, err) + os.Exit(1) + } } diff --git a/cmd/tools/cassandra/main.go b/cmd/tools/cassandra/main.go index ec8f42b132e..258cace839b 100644 --- a/cmd/tools/cassandra/main.go +++ b/cmd/tools/cassandra/main.go @@ -21,6 +21,7 @@ package main import ( + "fmt" "os" "github.com/uber/cadence/tools/cassandra" @@ -31,6 +32,7 @@ import ( func main() { err := cassandra.RunTool(os.Args) if err != nil { - panic(err) + _, _ = fmt.Fprintln(os.Stderr, err) + os.Exit(1) } } diff --git a/cmd/tools/cli/main.go b/cmd/tools/cli/main.go index baa4a9ad8fa..68adf9e016a 100644 --- a/cmd/tools/cli/main.go +++ b/cmd/tools/cli/main.go @@ -37,7 +37,7 @@ import ( func main() { app := cli.NewCliApp() if err := app.Run(os.Args); err != nil { - fmt.Fprintln(os.Stderr, err.Error()) + _, _ = fmt.Fprintln(app.ErrWriter, err) os.Exit(1) } } diff --git a/cmd/tools/sql/main.go b/cmd/tools/sql/main.go index ddac8002f4f..af7ac714192 100644 --- a/cmd/tools/sql/main.go +++ b/cmd/tools/sql/main.go @@ -21,6 +21,7 @@ package main import ( + "fmt" "os" "github.com/uber/cadence/tools/sql" @@ -32,6 +33,7 @@ import ( func main() { err := sql.RunTool(os.Args) if err != nil { - panic(err) + _, _ = fmt.Fprintln(os.Stderr, err) + os.Exit(1) } } diff --git a/go.work.sum b/go.work.sum index 76ba0b2b752..883fbe20f16 100644 --- a/go.work.sum +++ b/go.work.sum @@ -547,6 +547,7 @@ github.com/shirou/gopsutil/v3 v3.22.4 h1:srAQaiX6jX/cYL6q29aE0m8lOskT9CurZ9N61YR github.com/shirou/gopsutil/v3 v3.22.4/go.mod h1:D01hZJ4pVHPpCTZ3m3T2+wDF2YAGfd+H4ifUguaQzHM= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e h1:MZM7FHLqUHYI0Y/mQAt3d2aYa0SiNms/hFqC9qJYolM= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041 h1:llrF3Fs4018ePo4+G/HV/uQUqEI1HMDjCeOf2V6puPc= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/smartystreets/assertions v1.1.1 h1:T/YLemO5Yp7KPzS+lVtu+WsHn8yoSwTfItdAd1r3cck= github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9 h1:hp2CYQUINdZMHdvTdXtPOY2ainKl4IoMcpAXEf2xj3Q=