1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-19 20:57:53 +02:00
goreleaser/internal/exec/exec_mock_test.go
Oleksandr Redko 5a1353ddfa
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.
2024-11-09 15:10:14 -03:00

16 lines
169 B
Go

package exec
import (
"os"
"testing"
)
func TestMain(m *testing.M) {
if v := os.Getenv(MockEnvVar); v != "" {
os.Exit(ExecuteMockData(v))
return
}
m.Run()
}