defer os.RemoveAll(workDir)
}
+ // -buildmode=shared fundamentally does not work in module mode.
+ // (It tries to share package dependencies across builds, but in module mode
+ // each module has its own distinct set of dependency versions.)
+ // We would like to eliminate it (see https://go.dev/issue/47788),
+ // but first need to figure out a replacement that covers the small subset
+ // of use-cases where -buildmode=shared still works today.
+ // For now, run the tests in GOPATH mode only.
+ os.Setenv("GO111MODULE", "off")
+
// Some tests need to edit the source in GOPATH, so copy this directory to a
// temporary directory and chdir to that.
gopath := filepath.Join(workDir, "gopath")