WIP: Fix tests for `--nolegacy_external_runfiles`
diff --git a/.bazelrc b/.bazelrc
index c0e9e1c..592f0fd 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -17,7 +17,8 @@
build:incompatible --incompatible_config_setting_private_default_visibility
build:incompatible --incompatible_enforce_config_setting_visibility
build:incompatible --incompatible_disallow_empty_glob
+build:incompatible --nolegacy_external_runfiles
# Also enable all incompatible flags in go_bazel_test by default.
# TODO: Add --incompatible_disallow_empty_glob once
# https://github.com/bazelbuild/bazel-gazelle/pull/1405 has been released.
-test:incompatible --test_env=GO_BAZEL_TEST_BAZELFLAGS='--incompatible_load_proto_rules_from_bzl --incompatible_enable_cc_toolchain_resolution --incompatible_config_setting_private_default_visibility --incompatible_enforce_config_setting_visibility'
+test:incompatible --test_env=GO_BAZEL_TEST_BAZELFLAGS='--incompatible_load_proto_rules_from_bzl --incompatible_enable_cc_toolchain_resolution --incompatible_config_setting_private_default_visibility --incompatible_enforce_config_setting_visibility --nolegacy_external_runfiles'
diff --git a/go/tools/builders/stdliblist_test.go b/go/tools/builders/stdliblist_test.go
index b456b0b..132a5ed 100644
--- a/go/tools/builders/stdliblist_test.go
+++ b/go/tools/builders/stdliblist_test.go
@@ -15,7 +15,7 @@
test_args := []string{
fmt.Sprintf("-out=%s", outJSON),
- "-sdk=external/go_sdk",
+ "-sdk=../go_sdk",
}
if err := stdliblist(test_args); err != nil {
@@ -36,12 +36,12 @@
if !strings.HasPrefix(result.ID, "@io_bazel_rules_go//stdlib") {
t.Errorf("ID should be prefixed with @io_bazel_rules_go//stdlib :%v", result)
}
- if !strings.HasPrefix(result.ExportFile, "__BAZEL_OUTPUT_BASE__") {
- t.Errorf("export file should be prefixed with __BAZEL_OUTPUT_BASE__ :%v", result)
+ if !strings.HasPrefix(result.ExportFile, "go_sdk") {
+ t.Errorf("export file should be prefixed with go_sdk :%v", result)
}
for _, gofile := range result.GoFiles {
- if !strings.HasPrefix(gofile, "__BAZEL_OUTPUT_BASE__/external/go_sdk") {
- t.Errorf("all go files should be prefixed with __BAZEL_OUTPUT_BASE__/external/go_sdk :%v", result)
+ if !strings.HasPrefix(gofile, "go_sdk") {
+ t.Errorf("all go files should be prefixed with go_sdk")
}
}
}
diff --git a/tests/core/go_test/BUILD.bazel b/tests/core/go_test/BUILD.bazel
index 829ca8d..f895505 100644
--- a/tests/core/go_test/BUILD.bazel
+++ b/tests/core/go_test/BUILD.bazel
@@ -237,7 +237,7 @@
srcs = ["env_test.go"],
data = ["@go_sdk//:lib/time/zoneinfo.zip"],
env = {
- "ZONEINFO": "$(execpath @go_sdk//:lib/time/zoneinfo.zip)",
+ "ZONEINFO": "$(rootpath @go_sdk//:lib/time/zoneinfo.zip)",
},
deps = [
"@io_bazel_rules_go//go/tools/bazel",