It compares the list of active goroutines before and after the test and reports an error on mismatch.
To enable detector add a main_test.go file to the package.
To check a specific test only add noleak.Check(t)
at the top.
Tests using http.Client or http.DefaultClient should close idle connections.
See and run all examples:
GODEBUG=tracebackancestors=10 go test ./examples/...
Setting GODEBUG=tracebackancestors=N
extends tracebacks with the stacks at
which goroutines were created, where N limits the number of ancestor goroutines to
report, see https://pkg.go.dev/runtime#hdr-Environment_Variables.