diff --git a/plugin/checker/main_test.go b/plugin/checker/main_test.go index 82c01837fe..c05819b850 100644 --- a/plugin/checker/main_test.go +++ b/plugin/checker/main_test.go @@ -4,6 +4,7 @@ package main import ( + "os" "testing" "github.com/stretchr/testify/assert" @@ -35,6 +36,11 @@ func TestRunCheck(t *testing.T) { }, } + // Enable debug flag to have packagesdriver/sizes.go print stderr of `go list` command. + // We want to surface any error text that may exist in stderr of this command. + prevEnvValue := os.Getenv("GOPACKAGESPRINTGOLISTERRORS") + os.Setenv("GOPACKAGESPRINTGOLISTERRORS", "true") + for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { err := runCheck(tc.pkgPath) @@ -46,4 +52,5 @@ func TestRunCheck(t *testing.T) { } }) } + os.Setenv("GOPACKAGESPRINTGOLISTERRORS", prevEnvValue) }