1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-07-03 00:57:43 +02:00

test: remove redundant os.Exit in TestMain (#5257)

This PR simplifies tests by removing redundant `os.Exit` calls in
`TestMain` functions.

As of Go 1.15, we do not need to call `os.Exit(m.Run())` explicitly, as
value returned by `m.Run()` is stored into unexported field of `m` and
go test executable is smart enough to automatically call
`os.Exit(retValue)` when `TestMain` returns. See golang/go#34129.
This commit is contained in:
Oleksandr Redko
2024-11-09 20:10:14 +02:00
committed by GitHub
parent e5862356a5
commit 5a1353ddfa
5 changed files with 7 additions and 12 deletions

View File

@ -30,7 +30,8 @@ var listen string
func TestMain(m *testing.M) {
if !testlib.InPath("docker") {
os.Exit(m.Run())
m.Run()
return
}
prepareEnv()
@ -67,10 +68,9 @@ func TestMain(m *testing.M) {
}))
listen = "localhost:" + resource.GetPort("9000/tcp")
code := m.Run()
m.Run()
requireNoErr(pool.Purge(resource))
os.Exit(code)
}
func TestMinioUpload(t *testing.T) {