diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index 905dd68274..b39a62f3e4 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -287,6 +287,14 @@ func TestMain(m *testing.M) { os.Setenv("GOCACHE", testGOCACHE) // because $HOME is gone } + if testenv.Builder() != "" || os.Getenv("GIT_TRACE_CURL") == "1" { + // To help diagnose https://go.dev/issue/52545, + // enable tracing for Git HTTPS requests. + os.Setenv("GIT_TRACE_CURL", "1") + os.Setenv("GIT_TRACE_CURL_NO_DATA", "1") + os.Setenv("GIT_REDACT_COOKIES", "o,SSO,GSSO_Uberproxy") + } + r := m.Run() if !*testWork { removeAll(testTmpDir) // os.Exit won't run defer diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go index 33bad4d741..04bc8d581a 100644 --- a/src/cmd/go/script_test.go +++ b/src/cmd/go/script_test.go @@ -190,6 +190,14 @@ func (ts *testScript) setup() { "/=" + string(os.PathSeparator), "CMDGO_TEST_RUN_MAIN=true", } + if testenv.Builder() != "" || os.Getenv("GIT_TRACE_CURL") == "1" { + // To help diagnose https://go.dev/issue/52545, + // enable tracing for Git HTTPS requests. + ts.env = append(ts.env, + "GIT_TRACE_CURL=1", + "GIT_TRACE_CURL_NO_DATA=1", + "GIT_REDACT_COOKIES=o,SSO,GSSO_Uberproxy") + } if !testenv.HasExternalNetwork() { ts.env = append(ts.env, "TESTGONETWORK=panic", "TESTGOVCS=panic") }