]> Cypherpunks.ru repositories - gostls13.git/blobdiff - misc/cgo/testshared/shared_test.go
misc/cgo/testshared: run tests only in GOPATH mode
[gostls13.git] / misc / cgo / testshared / shared_test.go
index 024f084da55195945414c84d4e933976fdcd666f..756c4baa6b3a7ffdab14e36f5399b972c9fe477a 100644 (file)
@@ -108,6 +108,15 @@ func testMain(m *testing.M) (int, error) {
                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")