Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary patch: ensure errors lead to exit(1) in main funcs #6318

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cmd/bench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
5 changes: 4 additions & 1 deletion cmd/canary/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
6 changes: 5 additions & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package main

import (
"fmt"
"os"

"github.com/uber/cadence/cmd/server/cadence"
Expand All @@ -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)
}
}
4 changes: 3 additions & 1 deletion cmd/tools/cassandra/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package main

import (
"fmt"
"os"

"github.com/uber/cadence/tools/cassandra"
Expand All @@ -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)
}
}
2 changes: 1 addition & 1 deletion cmd/tools/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
4 changes: 3 additions & 1 deletion cmd/tools/sql/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package main

import (
"fmt"
"os"

"github.com/uber/cadence/tools/sql"
Expand All @@ -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)
}
}
1 change: 1 addition & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change expected?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it came in because I made other dependency changes lately... but make tidy (and thus go mod tidy) doesn't get rid of it, so I think yes? or at least it's harmless, unless CI takes issue with it.

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=
Expand Down
Loading