Skip to content

Commit

Permalink
Fix revive warning in testmain.go files
Browse files Browse the repository at this point in the history
When configuring nogo() to run the revive linter, we currently see
builds of testmain.go files fail with the following error:

    if block ends with call to os.Exit function, so drop this else and outdent its block (move short variable declaration to its own line if necessary)

Let's restructure this code slightly, so that this is no longer an
issue.
  • Loading branch information
EdSchouten committed Jun 11, 2024
1 parent 6f206ad commit ed5c40f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions go/tools/builders/generate_test_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,14 @@ func testsInShard() []testing.InternalTest {
func main() {
if bzltestutil.ShouldWrap() {
err := bzltestutil.Wrap("{{.Pkgname}}")
exitCode := 0
if xerr, ok := err.(*exec.ExitError); ok {
os.Exit(xerr.ExitCode())
exitCode = xerr.ExitCode()
} else if err != nil {
log.Print(err)
os.Exit(bzltestutil.TestWrapperAbnormalExit)
} else {
os.Exit(0)
exitCode = bzltestutil.TestWrapperAbnormalExit
}
os.Exit(exitCode)
}
testDeps :=
Expand Down

0 comments on commit ed5c40f

Please sign in to comment.