diff --git a/.golangci.yml b/.golangci.yml index 96a738624ce..4ce0db6f07b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -268,7 +268,7 @@ linters: - tagliatelle - tenv - testableexamples - # - testpackage # TODO: Enable once https://github.com/gofiber/fiber/issues/2252 is implemente + # - testpackage # TODO: Enable once https://github.com/gofiber/fiber/issues/2252 is implemented - thelper - tparallel - typecheck diff --git a/helpers.go b/helpers.go index 47f4e906dc0..54c281cf4c8 100644 --- a/helpers.go +++ b/helpers.go @@ -26,7 +26,7 @@ import ( "github.com/valyala/fasthttp" ) -// Guards overwrites to os.Stdout and Os.Stderr +// Guards overwrites to os.Stdout and os.Stderr var osStdVarMu sync.RWMutex // getTLSConfig returns a net listener's tls config diff --git a/middleware/idempotency/response.go b/middleware/idempotency/response.go index 94cec73ae4b..ca06bcb452f 100644 --- a/middleware/idempotency/response.go +++ b/middleware/idempotency/response.go @@ -1,5 +1,6 @@ package idempotency +//go:generate msgp -o=response_msgp.go -io=false -unexported type response struct { StatusCode int `msg:"sc"` diff --git a/prefork_test.go b/prefork_test.go index 8ef53470671..82d5e34db8a 100644 --- a/prefork_test.go +++ b/prefork_test.go @@ -19,10 +19,7 @@ func Test_App_Prefork_Child_Process(t *testing.T) { // Reset test var testPreforkMaster = true - utils.AssertEqual(t, nil, os.Setenv(envPreforkChildKey, envPreforkChildVal)) - t.Cleanup(func() { - utils.AssertEqual(t, nil, os.Setenv(envPreforkChildKey, "")) - }) + t.Setenv(envPreforkChildKey, envPreforkChildVal) app := New() @@ -74,13 +71,9 @@ func Test_App_Prefork_Master_Process(t *testing.T) { dummyChildCmd.Store("") } +//nolint:paralleltest // Test is using t.Setenv which can't be run in parallel func Test_App_Prefork_Child_Process_Never_Show_Startup_Message(t *testing.T) { - t.Parallel() - - utils.AssertEqual(t, nil, os.Setenv(envPreforkChildKey, envPreforkChildVal)) - t.Cleanup(func() { - utils.AssertEqual(t, nil, os.Setenv(envPreforkChildKey, "")) - }) + t.Setenv(envPreforkChildKey, envPreforkChildVal) rescueStdout := os.Stdout defer func() { os.Stdout = rescueStdout }() //nolint:reassign // Must do this inside the test