diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-1/BUILD.bazel b/go/ql/integration-tests/all-platforms/go/bazel-sample-1/src/BUILD.bazel similarity index 100% rename from go/ql/integration-tests/all-platforms/go/bazel-sample-1/BUILD.bazel rename to go/ql/integration-tests/all-platforms/go/bazel-sample-1/src/BUILD.bazel diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-1/go.mod b/go/ql/integration-tests/all-platforms/go/bazel-sample-1/src/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/bazel-sample-1/go.mod rename to go/ql/integration-tests/all-platforms/go/bazel-sample-1/src/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-1/go.sum b/go/ql/integration-tests/all-platforms/go/bazel-sample-1/src/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/bazel-sample-1/go.sum rename to go/ql/integration-tests/all-platforms/go/bazel-sample-1/src/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.go b/go/ql/integration-tests/all-platforms/go/bazel-sample-1/src/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.go rename to go/ql/integration-tests/all-platforms/go/bazel-sample-1/src/test.go diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-1/todel.go b/go/ql/integration-tests/all-platforms/go/bazel-sample-1/src/todel.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/bazel-sample-1/todel.go rename to go/ql/integration-tests/all-platforms/go/bazel-sample-1/src/todel.go diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.expected b/go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.expected index 00f0cbe3e017..57ce454f2dfd 100644 --- a/go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.expected +++ b/go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.expected @@ -1,7 +1,7 @@ +#select +| src/test.go:0:0:0:0 | src/test.go | +| src/todel.go:0:0:0:0 | src/todel.go | htmlFiles extractionErrors | Extraction failed in test.go with error \tother declaration of test | 2 | | Extraction failed in todel.go with error test redeclared in this block | 2 | -#select -| test.go:0:0:0:0 | test.go | -| todel.go:0:0:0:0 | todel.go | diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.py b/go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.py index 71ace021c221..91e95c1aeb60 100644 --- a/go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.py +++ b/go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.py @@ -1,8 +1,19 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * -run_codeql_database_create([], lang="go") +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath + +run_codeql_database_create([], lang="go", source="src") check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-2/BUILD b/go/ql/integration-tests/all-platforms/go/bazel-sample-2/src/BUILD similarity index 100% rename from go/ql/integration-tests/all-platforms/go/bazel-sample-2/BUILD rename to go/ql/integration-tests/all-platforms/go/bazel-sample-2/src/BUILD diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-2/go.mod b/go/ql/integration-tests/all-platforms/go/bazel-sample-2/src/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/bazel-sample-2/go.mod rename to go/ql/integration-tests/all-platforms/go/bazel-sample-2/src/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-2/go.sum b/go/ql/integration-tests/all-platforms/go/bazel-sample-2/src/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/bazel-sample-2/go.sum rename to go/ql/integration-tests/all-platforms/go/bazel-sample-2/src/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.go b/go/ql/integration-tests/all-platforms/go/bazel-sample-2/src/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.go rename to go/ql/integration-tests/all-platforms/go/bazel-sample-2/src/test.go diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-2/todel.go b/go/ql/integration-tests/all-platforms/go/bazel-sample-2/src/todel.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/bazel-sample-2/todel.go rename to go/ql/integration-tests/all-platforms/go/bazel-sample-2/src/todel.go diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.expected b/go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.expected index 00f0cbe3e017..57ce454f2dfd 100644 --- a/go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.expected +++ b/go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.expected @@ -1,7 +1,7 @@ +#select +| src/test.go:0:0:0:0 | src/test.go | +| src/todel.go:0:0:0:0 | src/todel.go | htmlFiles extractionErrors | Extraction failed in test.go with error \tother declaration of test | 2 | | Extraction failed in todel.go with error test redeclared in this block | 2 | -#select -| test.go:0:0:0:0 | test.go | -| todel.go:0:0:0:0 | todel.go | diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.py b/go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.py index 71ace021c221..91e95c1aeb60 100644 --- a/go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.py +++ b/go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.py @@ -1,8 +1,19 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * -run_codeql_database_create([], lang="go") +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath + +run_codeql_database_create([], lang="go", source="src") check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/test.py index 9f34f431b933..8364349c22c6 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/test.py @@ -1,9 +1,19 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" run_codeql_database_create([], lang="go", source="work", db=None) check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/test.py index 2f43492da41b..778af4464c7b 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/test.py @@ -1,9 +1,19 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" run_codeql_database_create([], lang="go", source="work", db=None, runFunction=runUnsuccessfully) check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/test.py index 2f43492da41b..778af4464c7b 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/test.py @@ -1,9 +1,19 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" run_codeql_database_create([], lang="go", source="work", db=None, runFunction=runUnsuccessfully) check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/test.py index 2f43492da41b..778af4464c7b 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/test.py @@ -1,9 +1,19 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" run_codeql_database_create([], lang="go", source="work", db=None, runFunction=runUnsuccessfully) check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/test.py index 9f34f431b933..8364349c22c6 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/test.py @@ -1,9 +1,19 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" run_codeql_database_create([], lang="go", source="work", db=None) check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/test.py index 9f34f431b933..8364349c22c6 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/test.py @@ -1,9 +1,19 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" run_codeql_database_create([], lang="go", source="work", db=None) check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/test.py index be9ec6f5b7a0..21a6cd40ef7d 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/test.py @@ -1,9 +1,19 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath os.environ['GITHUB_REPOSITORY'] = "a/b" run_codeql_database_create([], lang="go", source="work", db=None, runFunction=runUnsuccessfully) check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.go b/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/src/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.go rename to go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/src/test.go diff --git a/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.expected b/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.expected index 98462a92926f..b77d73586b8d 100644 --- a/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.expected +++ b/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.expected @@ -1,4 +1,4 @@ +#select +| src/test.go:0:0:0:0 | src/test.go | htmlFiles extractionErrors -#select -| test.go:0:0:0:0 | test.go | diff --git a/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.py b/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.py index a59be00eeb33..481759285e29 100644 --- a/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.py +++ b/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.py @@ -1,5 +1,15 @@ -import sys +import os +import subprocess from create_database_utils import * -run_codeql_database_create([], lang="go") +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath +run_codeql_database_create([], lang="go", source="src") + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/go-mod-sample/Makefile b/go/ql/integration-tests/all-platforms/go/go-mod-sample/src/Makefile similarity index 100% rename from go/ql/integration-tests/all-platforms/go/go-mod-sample/Makefile rename to go/ql/integration-tests/all-platforms/go/go-mod-sample/src/Makefile diff --git a/go/ql/integration-tests/all-platforms/go/go-mod-sample/go.mod b/go/ql/integration-tests/all-platforms/go/go-mod-sample/src/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/go-mod-sample/go.mod rename to go/ql/integration-tests/all-platforms/go/go-mod-sample/src/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/go-mod-sample/go.sum b/go/ql/integration-tests/all-platforms/go/go-mod-sample/src/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/go-mod-sample/go.sum rename to go/ql/integration-tests/all-platforms/go/go-mod-sample/src/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/go-mod-sample/test.go b/go/ql/integration-tests/all-platforms/go/go-mod-sample/src/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/go-mod-sample/test.go rename to go/ql/integration-tests/all-platforms/go/go-mod-sample/src/test.go diff --git a/go/ql/integration-tests/all-platforms/go/go-mod-sample/test.expected b/go/ql/integration-tests/all-platforms/go/go-mod-sample/test.expected index 12f9e2133331..b77d73586b8d 100644 --- a/go/ql/integration-tests/all-platforms/go/go-mod-sample/test.expected +++ b/go/ql/integration-tests/all-platforms/go/go-mod-sample/test.expected @@ -1,4 +1,4 @@ +#select +| src/test.go:0:0:0:0 | src/test.go | htmlFiles extractionErrors -#select -| test.go:0:0:0:0 | test.go | \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/go-mod-sample/test.py b/go/ql/integration-tests/all-platforms/go/go-mod-sample/test.py index a59be00eeb33..481759285e29 100644 --- a/go/ql/integration-tests/all-platforms/go/go-mod-sample/test.py +++ b/go/ql/integration-tests/all-platforms/go/go-mod-sample/test.py @@ -1,5 +1,15 @@ -import sys +import os +import subprocess from create_database_utils import * -run_codeql_database_create([], lang="go") +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath +run_codeql_database_create([], lang="go", source="src") + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/make-sample/Makefile b/go/ql/integration-tests/all-platforms/go/make-sample/src/Makefile similarity index 100% rename from go/ql/integration-tests/all-platforms/go/make-sample/Makefile rename to go/ql/integration-tests/all-platforms/go/make-sample/src/Makefile diff --git a/go/ql/integration-tests/all-platforms/go/make-sample/go.mod b/go/ql/integration-tests/all-platforms/go/make-sample/src/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/make-sample/go.mod rename to go/ql/integration-tests/all-platforms/go/make-sample/src/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/make-sample/go.sum b/go/ql/integration-tests/all-platforms/go/make-sample/src/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/make-sample/go.sum rename to go/ql/integration-tests/all-platforms/go/make-sample/src/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/make-sample/test.go b/go/ql/integration-tests/all-platforms/go/make-sample/src/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/make-sample/test.go rename to go/ql/integration-tests/all-platforms/go/make-sample/src/test.go diff --git a/go/ql/integration-tests/all-platforms/go/make-sample/todel.go b/go/ql/integration-tests/all-platforms/go/make-sample/src/todel.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/make-sample/todel.go rename to go/ql/integration-tests/all-platforms/go/make-sample/src/todel.go diff --git a/go/ql/integration-tests/all-platforms/go/make-sample/test.expected b/go/ql/integration-tests/all-platforms/go/make-sample/test.expected index 98462a92926f..b77d73586b8d 100644 --- a/go/ql/integration-tests/all-platforms/go/make-sample/test.expected +++ b/go/ql/integration-tests/all-platforms/go/make-sample/test.expected @@ -1,4 +1,4 @@ +#select +| src/test.go:0:0:0:0 | src/test.go | htmlFiles extractionErrors -#select -| test.go:0:0:0:0 | test.go | diff --git a/go/ql/integration-tests/all-platforms/go/make-sample/test.py b/go/ql/integration-tests/all-platforms/go/make-sample/test.py index a59be00eeb33..481759285e29 100644 --- a/go/ql/integration-tests/all-platforms/go/make-sample/test.py +++ b/go/ql/integration-tests/all-platforms/go/make-sample/test.py @@ -1,5 +1,15 @@ -import sys +import os +import subprocess from create_database_utils import * -run_codeql_database_create([], lang="go") +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath +run_codeql_database_create([], lang="go", source="src") + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/ninja-sample/.ninja_log b/go/ql/integration-tests/all-platforms/go/ninja-sample/src/.ninja_log similarity index 100% rename from go/ql/integration-tests/all-platforms/go/ninja-sample/.ninja_log rename to go/ql/integration-tests/all-platforms/go/ninja-sample/src/.ninja_log diff --git a/go/ql/integration-tests/all-platforms/go/ninja-sample/build.ninja b/go/ql/integration-tests/all-platforms/go/ninja-sample/src/build.ninja similarity index 100% rename from go/ql/integration-tests/all-platforms/go/ninja-sample/build.ninja rename to go/ql/integration-tests/all-platforms/go/ninja-sample/src/build.ninja diff --git a/go/ql/integration-tests/all-platforms/go/ninja-sample/go.mod b/go/ql/integration-tests/all-platforms/go/ninja-sample/src/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/ninja-sample/go.mod rename to go/ql/integration-tests/all-platforms/go/ninja-sample/src/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/ninja-sample/go.sum b/go/ql/integration-tests/all-platforms/go/ninja-sample/src/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/ninja-sample/go.sum rename to go/ql/integration-tests/all-platforms/go/ninja-sample/src/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/ninja-sample/test.go b/go/ql/integration-tests/all-platforms/go/ninja-sample/src/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/ninja-sample/test.go rename to go/ql/integration-tests/all-platforms/go/ninja-sample/src/test.go diff --git a/go/ql/integration-tests/all-platforms/go/ninja-sample/todel.go b/go/ql/integration-tests/all-platforms/go/ninja-sample/src/todel.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/ninja-sample/todel.go rename to go/ql/integration-tests/all-platforms/go/ninja-sample/src/todel.go diff --git a/go/ql/integration-tests/all-platforms/go/ninja-sample/test.expected b/go/ql/integration-tests/all-platforms/go/ninja-sample/test.expected index 98462a92926f..b77d73586b8d 100644 --- a/go/ql/integration-tests/all-platforms/go/ninja-sample/test.expected +++ b/go/ql/integration-tests/all-platforms/go/ninja-sample/test.expected @@ -1,4 +1,4 @@ +#select +| src/test.go:0:0:0:0 | src/test.go | htmlFiles extractionErrors -#select -| test.go:0:0:0:0 | test.go | diff --git a/go/ql/integration-tests/all-platforms/go/ninja-sample/test.py b/go/ql/integration-tests/all-platforms/go/ninja-sample/test.py index a59be00eeb33..481759285e29 100644 --- a/go/ql/integration-tests/all-platforms/go/ninja-sample/test.py +++ b/go/ql/integration-tests/all-platforms/go/ninja-sample/test.py @@ -1,5 +1,15 @@ -import sys +import os +import subprocess from create_database_utils import * -run_codeql_database_create([], lang="go") +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath +run_codeql_database_create([], lang="go", source="src") + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/main.go b/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/src/main.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/main.go rename to go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/src/main.go diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/subdir/go.mod b/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/src/subdir/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/subdir/go.mod rename to go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/src/subdir/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/subdir/go.sum b/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/src/subdir/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/subdir/go.sum rename to go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/src/subdir/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/subdir/subsubdir/add.go b/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/src/subdir/subsubdir/add.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/subdir/subsubdir/add.go rename to go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/src/subdir/subsubdir/add.go diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/subdir/test.go b/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/src/subdir/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/subdir/test.go rename to go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/src/subdir/test.go diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/test.py b/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/test.py index 71ace021c221..43c7d1b38e88 100644 --- a/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/test.py +++ b/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/test.py @@ -1,8 +1,18 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * -run_codeql_database_create([], lang="go") +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath +run_codeql_database_create([], lang="go", source="src") check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/go.mod b/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/src/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/go.mod rename to go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/src/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/go.sum b/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/src/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/go.sum rename to go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/src/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/subdir/add.go b/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/src/subdir/add.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/subdir/add.go rename to go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/src/subdir/add.go diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/test.go b/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/src/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/test.go rename to go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/src/test.go diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/test.py b/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/test.py index 71ace021c221..43c7d1b38e88 100644 --- a/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/test.py +++ b/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/test.py @@ -1,8 +1,18 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * -run_codeql_database_create([], lang="go") +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath +run_codeql_database_create([], lang="go", source="src") check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/subdir/go.mod b/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/src/subdir/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/subdir/go.mod rename to go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/src/subdir/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/subdir/go.sum b/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/src/subdir/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/subdir/go.sum rename to go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/src/subdir/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/subdir/subsubdir/add.go b/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/src/subdir/subsubdir/add.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/subdir/subsubdir/add.go rename to go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/src/subdir/subsubdir/add.go diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/subdir/test.go b/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/src/subdir/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/subdir/test.go rename to go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/src/subdir/test.go diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/test.py b/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/test.py index 71ace021c221..43c7d1b38e88 100644 --- a/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/test.py +++ b/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/test.py @@ -1,8 +1,18 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * -run_codeql_database_create([], lang="go") +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath +run_codeql_database_create([], lang="go", source="src") check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/go.work b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/go.work similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/go.work rename to go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/go.work diff --git a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir1/go.mod b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir1/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir1/go.mod rename to go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir1/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir1/go.sum b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir1/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir1/go.sum rename to go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir1/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir1/subsubdir1/add.go b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir1/subsubdir1/add.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir1/subsubdir1/add.go rename to go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir1/subsubdir1/add.go diff --git a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir1/test.go b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir1/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir1/test.go rename to go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir1/test.go diff --git a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir2/go.mod b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir2/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir2/go.mod rename to go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir2/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir2/go.sum b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir2/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir2/go.sum rename to go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir2/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir2/subsubdir2/add.go b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir2/subsubdir2/add.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir2/subsubdir2/add.go rename to go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir2/subsubdir2/add.go diff --git a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir2/test.go b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir2/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/modules/subdir2/test.go rename to go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/src/modules/subdir2/test.go diff --git a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/test.py b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/test.py index 71ace021c221..43c7d1b38e88 100644 --- a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/test.py +++ b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/test.py @@ -1,8 +1,18 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * -run_codeql_database_create([], lang="go") +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath +run_codeql_database_create([], lang="go", source="src") check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/go.mod b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/go.mod rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/go.sum b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/go.sum rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/subdir1/go.mod b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/subdir1/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/subdir1/go.mod rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/subdir1/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/subdir1/go.sum b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/subdir1/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/subdir1/go.sum rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/subdir1/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/subdir1/subsubdir1/add.go b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/subdir1/subsubdir1/add.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/subdir1/subsubdir1/add.go rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/subdir1/subsubdir1/add.go diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/subdir1/test.go b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/subdir1/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/subdir1/test.go rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/subdir1/test.go diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/subdir2/add.go b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/subdir2/add.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/subdir2/add.go rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/subdir2/add.go diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/test.go b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/subdir0/test.go rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/src/subdir0/test.go diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/test.py b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/test.py index 71ace021c221..43c7d1b38e88 100644 --- a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/test.py +++ b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/test.py @@ -1,8 +1,18 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * -run_codeql_database_create([], lang="go") +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath +run_codeql_database_create([], lang="go", source="src") check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/go.mod b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/go.mod rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/go.sum b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/go.sum rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/subdir1/go.mod b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/subdir1/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/subdir1/go.mod rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/subdir1/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/subdir1/go.sum b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/subdir1/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/subdir1/go.sum rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/subdir1/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/subdir1/subsubdir1/add.go b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/subdir1/subsubdir1/add.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/subdir1/subsubdir1/add.go rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/subdir1/subsubdir1/add.go diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/subdir1/test.go b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/subdir1/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/subdir1/test.go rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/subdir1/test.go diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/subdir2/add.go b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/subdir2/add.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/subdir2/add.go rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/subdir2/add.go diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/test.go b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/test.go rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/src/test.go diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/test.py b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/test.py index 71ace021c221..43c7d1b38e88 100644 --- a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/test.py +++ b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/test.py @@ -1,8 +1,18 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * -run_codeql_database_create([], lang="go") +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath +run_codeql_database_create([], lang="go", source="src") check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"]) diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir1/go.mod b/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir1/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir1/go.mod rename to go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir1/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir1/go.sum b/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir1/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir1/go.sum rename to go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir1/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir1/subsubdir1/add.go b/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir1/subsubdir1/add.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir1/subsubdir1/add.go rename to go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir1/subsubdir1/add.go diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir1/test.go b/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir1/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir1/test.go rename to go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir1/test.go diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir2/go.mod b/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir2/go.mod similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir2/go.mod rename to go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir2/go.mod diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir2/go.sum b/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir2/go.sum similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir2/go.sum rename to go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir2/go.sum diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir2/subsubdir2/add.go b/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir2/subsubdir2/add.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir2/subsubdir2/add.go rename to go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir2/subsubdir2/add.go diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir2/test.go b/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir2/test.go similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/subdir2/test.go rename to go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/src/subdir2/test.go diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/test.py b/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/test.py index 71ace021c221..43c7d1b38e88 100644 --- a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/test.py +++ b/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/test.py @@ -1,8 +1,18 @@ -import sys +import os +import subprocess from create_database_utils import * from diagnostics_test_utils import * -run_codeql_database_create([], lang="go") +# Set up a GOPATH relative to this test's root directory; +# we set os.environ instead of using extra_env because we +# need it to be set for the call to "go clean -modcache" later +goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") +os.environ['GOPATH'] = goPath +run_codeql_database_create([], lang="go", source="src") check_diagnostics() + +# Clean up the temporary GOPATH to prevent Bazel failures next +# time the tests are run; see https://github.com/golang/go/issues/27161 +subprocess.call(["go", "clean", "-modcache"])