chore: replace testing.Testing with flag lookup (#26552)

In our codebase we have an existing convention of using
`flag.Lookup("test.v")` instead of `testing.Testing()`. This avoids
pulling in the entire `testing` package. Another consequence: some of
our custom linters trigger upon import of the `testing` package which
can lead to unexpected linter errors.
This commit is contained in:
Cian Johnston
2026-06-19 19:59:54 +01:00
committed by GitHub
parent befa1176b9
commit d5ec26beac
5 changed files with 10 additions and 11 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
package agentmcp
import (
"flag"
"net/http"
"testing"
)
// mcpHTTPClient returns an isolated *http.Client when running
@@ -13,7 +13,7 @@ import (
// is a *http.Transport it is cloned; otherwise a minimal
// transport with ProxyFromEnvironment is created as a fallback.
func mcpHTTPClient() *http.Client {
if !testing.Testing() {
if flag.Lookup("test.v") == nil {
return nil
}
if dt, ok := http.DefaultTransport.(*http.Transport); ok {