diff --git a/BUILD.bazel b/BUILD.bazel index 7ed2446a7c..adf8fc1af6 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_go//go:def.bzl", "gazelle", "go_prefix", "go_path", "go_vet_test") +load("@io_bazel_rules_go//go:def.bzl", "gazelle", "go_path", "go_vet_test") load("@io_bazel_rules_go//go/private:tools/lines_sorted_test.bzl", "lines_sorted_test") load("@io_bazel_rules_go//go/private:rules/info.bzl", "go_info") load("@io_bazel_rules_go//proto:go_proto_library.bzl", "go_google_protobuf") @@ -16,9 +16,6 @@ go_context_data( # gazelle:prefix github.com/bazelbuild/rules_go -# TODO(jayconrod): remove when nothing depends on this. -go_prefix("github.com/bazelbuild/rules_go") - go_google_protobuf() lines_sorted_test( diff --git a/examples/bindata/BUILD.bazel b/examples/bindata/BUILD.bazel index eab89b20b1..6a39e8ff43 100644 --- a/examples/bindata/BUILD.bazel +++ b/examples/bindata/BUILD.bazel @@ -9,6 +9,7 @@ bindata( go_library( name = "go_default_library", + importpath = "github.com/bazelbuild/rules_go/examples/bindata", srcs = [":data"], ) diff --git a/examples/cgo/BUILD.bazel b/examples/cgo/BUILD.bazel index 5dd44ba9b4..8895af1074 100644 --- a/examples/cgo/BUILD.bazel +++ b/examples/cgo/BUILD.bazel @@ -14,6 +14,7 @@ go_library( "use_exported.c", "use_exported.h", ], + importpath = "github.com/bazelbuild/rules_go/examples/cgo", cdeps = ["//examples/cgo/cc_dependency:version"], cgo = True, clinkopts = ["-lm"], @@ -31,6 +32,7 @@ go_library( cgo = True, clinkopts = ["-lm"], visibility = ["//visibility:private"], + importpath = "github.com/bazelbuild/rules_go/examples/cgo/sub", ) go_test( diff --git a/examples/cgo/skip_go_library/BUILD.bazel b/examples/cgo/skip_go_library/BUILD.bazel index 2f60c63f0b..fb1772227f 100644 --- a/examples/cgo/skip_go_library/BUILD.bazel +++ b/examples/cgo/skip_go_library/BUILD.bazel @@ -9,4 +9,5 @@ go_library( "types.go", ], cgo = True, + importpath = "github.com/bazelbuild/rules_go/examples/cgo/skip_go_library", ) diff --git a/examples/lib/BUILD.bazel b/examples/lib/BUILD.bazel index 738981f9f4..bcf3d21d91 100644 --- a/examples/lib/BUILD.bazel +++ b/examples/lib/BUILD.bazel @@ -12,6 +12,7 @@ go_library( "lib.go", "sub.s", ], + importpath = "github.com/bazelbuild/rules_go/examples/lib", deps = ["//examples/lib/deep:go_default_library"], ) diff --git a/examples/lib/deep/BUILD.bazel b/examples/lib/deep/BUILD.bazel index 56ad62ba28..2faae0717a 100644 --- a/examples/lib/deep/BUILD.bazel +++ b/examples/lib/deep/BUILD.bazel @@ -8,4 +8,5 @@ go_library( "doc.go", "thought.go", ], + importpath = "github.com/bazelbuild/rules_go/examples/lib/deep", ) diff --git a/examples/proto/BUILD.bazel b/examples/proto/BUILD.bazel index 6e0c93e786..43b310f468 100644 --- a/examples/proto/BUILD.bazel +++ b/examples/proto/BUILD.bazel @@ -15,7 +15,6 @@ go_test( name = "proto_test", size = "small", srcs = ["proto_test.go"], - importpath = "github.com/bazelbuild/rules_go/examples/proto", pure = "off", deps = [ "//examples/proto/embed:go_default_library", @@ -27,7 +26,6 @@ go_test( name = "proto_pure_test", size = "small", srcs = ["proto_test.go"], - importpath = "github.com/bazelbuild/rules_go/examples/proto", pure = "on", deps = [ "//examples/proto/embed:go_default_library", diff --git a/examples/stamped_bin/stamp/BUILD.bazel b/examples/stamped_bin/stamp/BUILD.bazel index 6e3b8f61d7..be06c8f141 100644 --- a/examples/stamped_bin/stamp/BUILD.bazel +++ b/examples/stamped_bin/stamp/BUILD.bazel @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["stamp.go"], + importpath = "github.com/bazelbuild/rules_go/examples/stamped_bin/stamp", visibility = ["//visibility:public"], x_defs = { "XdefBuildTimestamp": "{BUILD_TIMESTAMP}", diff --git a/examples/vendor/github.com/user/vendored/BUILD.bazel b/examples/vendor/github.com/user/vendored/BUILD.bazel index c47e323861..3632cdcd22 100644 --- a/examples/vendor/github.com/user/vendored/BUILD.bazel +++ b/examples/vendor/github.com/user/vendored/BUILD.bazel @@ -9,4 +9,5 @@ go_library( srcs = [ "vendored.go", ], + importpath = "github.com/user/vendored", ) diff --git a/go/private/context.bzl b/go/private/context.bzl index 0971f4161a..7c42553fc4 100644 --- a/go/private/context.bzl +++ b/go/private/context.bzl @@ -121,14 +121,30 @@ def _infer_importpath(ctx): VENDOR_PREFIX = "/vendor/" # Check if import path was explicitly set path = getattr(ctx.attr, "importpath", "") + # are we in forced infer mode? + if path == "~auto~": + path = "" if path != "": return path, EXPLICIT_PATH # See if we can collect importpath from embeded libraries # This is the path that fixes tests as well for embed in getattr(ctx.attr, "embed", []): - if GoLibrary in embed: - if embed[GoLibrary].pathtype == EXPLICIT_PATH: - return embed[GoLibrary].importpath, EXPLICIT_PATH + if GoLibrary not in embed: + continue + if embed[GoLibrary].pathtype == EXPLICIT_PATH: + return embed[GoLibrary].importpath, EXPLICIT_PATH + # If we are a test, and we have a dep in the same package, presume + # we should be named the same with an _test suffix + if ctx.label.name.endswith("_test~library~"): + for dep in getattr(ctx.attr, "deps", []): + if GoLibrary not in dep: + continue + lib = dep[GoLibrary] + if lib.label.workspace_root != ctx.label.workspace_root: + continue + if lib.label.package != ctx.label.package: + continue + return lib.importpath + "_test", INFERRED_PATH # TODO: stop using the prefix prefix = getattr(ctx.attr, "_go_prefix", None) path = prefix.go_prefix if prefix else "" diff --git a/go/private/rules/wrappers.bzl b/go/private/rules/wrappers.bzl index 0425a9c180..dc5c9cc37d 100644 --- a/go/private/rules/wrappers.bzl +++ b/go/private/rules/wrappers.bzl @@ -17,7 +17,7 @@ load("@io_bazel_rules_go//go/private:rules/library.bzl", "go_library") load("@io_bazel_rules_go//go/private:rules/test.bzl", "go_test") load("@io_bazel_rules_go//go/private:rules/cgo.bzl", "setup_cgo_library") -def go_library_macro(name, srcs=None, embed=[], cgo=False, cdeps=[], copts=[], clinkopts=[], library=None, **kwargs): +def go_library_macro(name, srcs=None, embed=[], cgo=False, cdeps=[], copts=[], clinkopts=[], importpath="", library=None, **kwargs): """See go/core.rst#go_library for full documentation.""" if library: #TODO: print("\nDEPRECATED: {}//{}:{} : the library attribute is deprecated. Please migrate to embed.".format(native.repository_name(), native.package_name(), name)) @@ -37,16 +37,19 @@ def go_library_macro(name, srcs=None, embed=[], cgo=False, cdeps=[], copts=[], c name = name, srcs = srcs, embed = embed, + importpath = importpath, **kwargs ) +#TODO(#1207): Remove importpath def go_binary_macro(name, srcs=None, embed=[], cgo=False, cdeps=[], copts=[], clinkopts=[], library=None, importpath="", **kwargs): """See go/core.rst#go_binary for full documentation.""" if library: #TODO: print("\nDEPRECATED: {}//{}:{} : the library attribute is deprecated. Please migrate to embed.".format(native.repository_name(), native.package_name(), name)) embed = embed + [library] - #if importpath: - # print("\nDEPRECATED: {}//{}:{} : the importpath attribute on go_binary is deprecated.".format(native.repository_name(), native.package_name(), name)) + #TODO: Turn on the deprecation warning when gazelle stops adding these + #if importpath and native.repository_name() == "@": + # print("\nDEPRECATED: //{}:{} : the importpath attribute on go_binary is deprecated.".format(native.package_name(), name)) if cgo: cgo_embed = setup_cgo_library( @@ -65,13 +68,18 @@ def go_binary_macro(name, srcs=None, embed=[], cgo=False, cdeps=[], copts=[], cl **kwargs ) -def go_test_macro(name, srcs=None, deps=None, importpath="", library=None, embed=[], gc_goopts=[], cgo=False, cdeps=[], copts=[], clinkopts=[], x_defs={}, **kwargs): +#TODO(#1207): Remove importpath +def go_test_macro(name, srcs=None, deps=None, importpath=None, library=None, embed=[], gc_goopts=[], cgo=False, cdeps=[], copts=[], clinkopts=[], x_defs={}, **kwargs): """See go/core.rst#go_test for full documentation.""" if library: #TODO: print("\nDEPRECATED: {}//{}:{} : the library attribute is deprecated. Please migrate to embed.".format(native.repository_name(), native.package_name(), name)) embed = embed + [library] - #TODO: if importpath: - # print("\nDEPRECATED: {}//{}:{} : the importpath attribute on go_test is deprecated.".format(native.repository_name(), native.package_name(), name)) + if not importpath: + importpath = "~auto~" + #TODO: Turn on the deprecation warning when gazelle stops adding these + #elif native.repository_name() == "@": + # print("\nDEPRECATED: //{}:{} : the importpath attribute on go_test is deprecated.".format(native.package_name(), name)) + library_name = name + "~library~" go_library_macro( diff --git a/go/tools/bazel/BUILD.bazel b/go/tools/bazel/BUILD.bazel index 76bcdc4c23..4322e3ae01 100644 --- a/go/tools/bazel/BUILD.bazel +++ b/go/tools/bazel/BUILD.bazel @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = ["bazel.go"], + importpath = "github.com/bazelbuild/rules_go/go/tools/bazel", visibility = ["//visibility:public"], ) diff --git a/go/tools/fetch_repo/BUILD.bazel b/go/tools/fetch_repo/BUILD.bazel index 6977af0e1c..c3bd93d095 100644 --- a/go/tools/fetch_repo/BUILD.bazel +++ b/go/tools/fetch_repo/BUILD.bazel @@ -9,6 +9,7 @@ go_binary( go_library( name = "go_default_library", srcs = ["main.go"], + importpath = "github.com/bazelbuild/rules_go/go/tools/fetch_repo", visibility = ["//visibility:private"], deps = ["@org_golang_x_tools//go/vcs:go_default_library"], ) diff --git a/go/tools/gazelle/config/BUILD.bazel b/go/tools/gazelle/config/BUILD.bazel index d6544e3f5e..ce8afe8646 100644 --- a/go/tools/gazelle/config/BUILD.bazel +++ b/go/tools/gazelle/config/BUILD.bazel @@ -8,6 +8,7 @@ go_library( "directives.go", "platform.go", ], + importpath = "github.com/bazelbuild/rules_go/go/tools/gazelle/config", visibility = ["//visibility:public"], deps = ["@com_github_bazelbuild_buildtools//build:go_default_library"], ) diff --git a/go/tools/gazelle/gazelle/BUILD.bazel b/go/tools/gazelle/gazelle/BUILD.bazel index cb4de1b587..3f2374364d 100644 --- a/go/tools/gazelle/gazelle/BUILD.bazel +++ b/go/tools/gazelle/gazelle/BUILD.bazel @@ -9,6 +9,7 @@ go_library( "main.go", "print.go", ], + importpath = "github.com/bazelbuild/rules_go/go/tools/gazelle/gazelle", deps = [ "//go/tools/gazelle/config:go_default_library", "//go/tools/gazelle/merger:go_default_library", diff --git a/go/tools/gazelle/merger/BUILD.bazel b/go/tools/gazelle/merger/BUILD.bazel index 22764c3852..7d5bd38eea 100644 --- a/go/tools/gazelle/merger/BUILD.bazel +++ b/go/tools/gazelle/merger/BUILD.bazel @@ -6,6 +6,7 @@ go_library( "fix.go", "merger.go", ], + importpath = "github.com/bazelbuild/rules_go/go/tools/gazelle/merger", visibility = ["//visibility:public"], deps = [ "@com_github_bazelbuild_buildtools//build:go_default_library", diff --git a/go/tools/gazelle/packages/BUILD.bazel b/go/tools/gazelle/packages/BUILD.bazel index 27b854124f..b1b2bfb82d 100644 --- a/go/tools/gazelle/packages/BUILD.bazel +++ b/go/tools/gazelle/packages/BUILD.bazel @@ -10,6 +10,7 @@ go_library( "package.go", "walk.go", ], + importpath = "github.com/bazelbuild/rules_go/go/tools/gazelle/packages", visibility = ["//visibility:public"], deps = [ "//go/tools/gazelle/config:go_default_library", diff --git a/go/tools/gazelle/resolve/BUILD.bazel b/go/tools/gazelle/resolve/BUILD.bazel index fb5e5ea6e4..aa981d5f1c 100644 --- a/go/tools/gazelle/resolve/BUILD.bazel +++ b/go/tools/gazelle/resolve/BUILD.bazel @@ -11,6 +11,7 @@ go_library( "resolve_vendored.go", "std_package_list.go", ], + importpath = "github.com/bazelbuild/rules_go/go/tools/gazelle/resolve", visibility = ["//visibility:public"], deps = [ "@com_github_bazelbuild_buildtools//build:go_default_library", diff --git a/go/tools/gazelle/rules/BUILD.bazel b/go/tools/gazelle/rules/BUILD.bazel index 53cc81ff04..2fe0e3dca8 100644 --- a/go/tools/gazelle/rules/BUILD.bazel +++ b/go/tools/gazelle/rules/BUILD.bazel @@ -8,6 +8,7 @@ go_library( "generator.go", "sort_labels.go", ], + importpath = "github.com/bazelbuild/rules_go/go/tools/gazelle/rules", visibility = ["//visibility:public"], deps = [ "//go/tools/gazelle/config:go_default_library", diff --git a/go/tools/gazelle/wspace/BUILD.bazel b/go/tools/gazelle/wspace/BUILD.bazel index 165b02a2d3..49071f5b64 100644 --- a/go/tools/gazelle/wspace/BUILD.bazel +++ b/go/tools/gazelle/wspace/BUILD.bazel @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = ["finder.go"], + importpath = "github.com/bazelbuild/rules_go/go/tools/gazelle/wspace", visibility = ["//visibility:public"], ) diff --git a/tests/asm_include/BUILD.bazel b/tests/asm_include/BUILD.bazel index b3ad8638b4..2ae195b438 100644 --- a/tests/asm_include/BUILD.bazel +++ b/tests/asm_include/BUILD.bazel @@ -25,6 +25,7 @@ go_library( ":darwin_amd64": LIB_AMD64_SRCS, "//conditions:default": LIB_OTHER_SRCS, }), + importpath = "github.com/bazelbuild/rules_go/tests/asm_include", ) go_test( diff --git a/tests/build_constraints/BUILD.bazel b/tests/build_constraints/BUILD.bazel index ae049ee163..5f012ed459 100644 --- a/tests/build_constraints/BUILD.bazel +++ b/tests/build_constraints/BUILD.bazel @@ -27,6 +27,7 @@ go_library( ":c_srcs_group", ], cgo = True, + importpath = "github.com/bazelbuild/rules_go/tests/build_constraints", ) filegroup( diff --git a/tests/cgo_filtered/BUILD.bazel b/tests/cgo_filtered/BUILD.bazel index 87631d07e8..2c4f8d4155 100644 --- a/tests/cgo_filtered/BUILD.bazel +++ b/tests/cgo_filtered/BUILD.bazel @@ -11,4 +11,5 @@ go_library( name = "go_default_library", srcs = ["pure.go"], cgo = True, + importpath = "github.com/bazelbuild/rules_go/tests/cgo_filtered", ) diff --git a/tests/cgo_library_root_dir/BUILD.bazel b/tests/cgo_library_root_dir/BUILD.bazel index 43234470ef..407e995d28 100644 --- a/tests/cgo_library_root_dir/BUILD.bazel +++ b/tests/cgo_library_root_dir/BUILD.bazel @@ -18,6 +18,7 @@ go_library( "foo.c", ], cgo = True, + importpath = "github.com/bazelbuild/rules_go/tests/cgo_library_root_dir", tags = ["manual"], ) diff --git a/tests/cgo_multi_dir/BUILD.bazel b/tests/cgo_multi_dir/BUILD.bazel index 59d2b4cc60..491dbcddc8 100644 --- a/tests/cgo_multi_dir/BUILD.bazel +++ b/tests/cgo_multi_dir/BUILD.bazel @@ -18,4 +18,5 @@ go_library( "foo/foo.go", ], cgo = True, + importpath = "github.com/bazelbuild/rules_go/tests/cgo_multi_dir", ) diff --git a/tests/cgo_opts/BUILD.bazel b/tests/cgo_opts/BUILD.bazel index 77953afe6a..d8e51c3473 100644 --- a/tests/cgo_opts/BUILD.bazel +++ b/tests/cgo_opts/BUILD.bazel @@ -13,5 +13,4 @@ go_test( name = "go_default_test", srcs = ["cgo_opts_test.go"], embed = [":go_default_library"], - importpath = "github.com/bazelbuild/rules_go/tests/cgo_opts", ) diff --git a/tests/cgo_pthread_flag/BUILD.bazel b/tests/cgo_pthread_flag/BUILD.bazel index d18a3b00bd..b843ea7d6c 100644 --- a/tests/cgo_pthread_flag/BUILD.bazel +++ b/tests/cgo_pthread_flag/BUILD.bazel @@ -4,6 +4,7 @@ go_library( name = "go_default_library", srcs = ["cgo_pthread_flag.go"], cgo = True, + importpath = "github.com/bazelbuild/rules_go/tests/cgo_pthread_flag", ) go_test( diff --git a/tests/cgo_pure/BUILD.bazel b/tests/cgo_pure/BUILD.bazel index ff8be2cdfb..6de07e8d6a 100644 --- a/tests/cgo_pure/BUILD.bazel +++ b/tests/cgo_pure/BUILD.bazel @@ -9,6 +9,7 @@ go_library( "pure.go", ], cgo = True, + importpath = "github.com/bazelbuild/rules_go/tests/cgo_pure", ) go_test( diff --git a/tests/cgo_select/BUILD.bazel b/tests/cgo_select/BUILD.bazel index 0c715b1c75..4b91b1a50e 100644 --- a/tests/cgo_select/BUILD.bazel +++ b/tests/cgo_select/BUILD.bazel @@ -25,6 +25,7 @@ go_library( ], }), cgo = True, + importpath = "github.com/bazelbuild/rules_go/tests/cgo_select", ) cc_library( diff --git a/tests/cgo_sys_hdr/BUILD.bazel b/tests/cgo_sys_hdr/BUILD.bazel index a214eda2b4..49daeee44d 100644 --- a/tests/cgo_sys_hdr/BUILD.bazel +++ b/tests/cgo_sys_hdr/BUILD.bazel @@ -7,6 +7,7 @@ go_library( "sub/foo.h", ], cgo = True, + importpath = "github.com/bazelbuild/rules_go/tests/cgo_sys_hdr", ) go_test( diff --git a/tests/cgo_trans_deps/BUILD.bazel b/tests/cgo_trans_deps/BUILD.bazel index 0ff26df3d8..5ec69d5a94 100644 --- a/tests/cgo_trans_deps/BUILD.bazel +++ b/tests/cgo_trans_deps/BUILD.bazel @@ -4,6 +4,7 @@ go_library( name = "go_default_library", srcs = ["cgo_lib.go"], cgo = True, + importpath = "github.com/bazelbuild/rules_go/tests/cgo_trans_deps", deps = ["//tests/cgo_trans_deps/dep:go_default_library"], ) diff --git a/tests/cgo_trans_deps/dep/BUILD.bazel b/tests/cgo_trans_deps/dep/BUILD.bazel index 55e37ebe19..9dfe5602ed 100644 --- a/tests/cgo_trans_deps/dep/BUILD.bazel +++ b/tests/cgo_trans_deps/dep/BUILD.bazel @@ -3,5 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["dep.go"], + importpath = "github.com/bazelbuild/rules_go/tests/cgo_trans_deps/dep", visibility = ["//visibility:public"], ) diff --git a/tests/coverage/BUILD.bazel b/tests/coverage/BUILD.bazel index b4c4e1eb50..5d017e2b9c 100644 --- a/tests/coverage/BUILD.bazel +++ b/tests/coverage/BUILD.bazel @@ -14,6 +14,7 @@ go_test( go_library( name = "go_default_library", srcs = ["lib.go"], + importpath = "github.com/bazelbuild/rules_go/tests/coverage", ) bazel_test( @@ -37,6 +38,7 @@ go_binary( go_library( name = "bin_lib", srcs = ["bin_lib.go"], + importpath = "github.com/bazelbuild/rules_go/tests/coverage", ) bazel_test( diff --git a/tests/empty_package/BUILD.bazel b/tests/empty_package/BUILD.bazel index c11be849cf..d90e59f74e 100644 --- a/tests/empty_package/BUILD.bazel +++ b/tests/empty_package/BUILD.bazel @@ -24,7 +24,6 @@ go_test( name = "empty_package_cgo", size = "small", srcs = ["empty_package_test.go"], - importpath = "github.com/bazelbuild/rules_go/tests/empty_package_test", pure = "off", x_defs = { "Expect": "2", @@ -36,7 +35,6 @@ go_test( name = "empty_package_pure", size = "small", srcs = ["empty_package_test.go"], - importpath = "github.com/bazelbuild/rules_go/tests/empty_package_test", pure = "on", x_defs = { "Expect": "1", diff --git a/tests/gc_opts_unsafe/BUILD.bazel b/tests/gc_opts_unsafe/BUILD.bazel index d2ddea3eea..d923c25acf 100644 --- a/tests/gc_opts_unsafe/BUILD.bazel +++ b/tests/gc_opts_unsafe/BUILD.bazel @@ -6,12 +6,14 @@ go_library( srcs = ["unsafe.go"], gc_goopts = ["-u"], tags = ["manual"], + importpath = "github.com/bazelbuild/rules_go/tests/gc_opts_unsafe", ) go_library( name = "unsafe_library_lib", embed = [":unsafe_srcs_lib"], tags = ["manual"], + importpath = "github.com/bazelbuild/rules_go/tests/gc_opts_unsafe", ) go_binary( @@ -55,12 +57,14 @@ go_library( cgo = True, gc_goopts = ["-u"], tags = ["manual"], + importpath = "github.com/bazelbuild/rules_go/tests/gc_opts_unsafe", ) go_library( name = "unsafe_cgo_client_lib", embed = [":unsafe_cgo_lib"], tags = ["manual"], + importpath = "github.com/bazelbuild/rules_go/tests/gc_opts_unsafe", ) go_binary( diff --git a/tests/go_embed_data/BUILD.bazel b/tests/go_embed_data/BUILD.bazel index a9282252aa..9debdfa902 100644 --- a/tests/go_embed_data/BUILD.bazel +++ b/tests/go_embed_data/BUILD.bazel @@ -21,6 +21,7 @@ go_library( ":single", ":str", ], + importpath = "github.com/bazelbuild/rules_go/tests/go_embed_data", ) go_embed_data( diff --git a/tests/no_prefix/BUILD.bazel b/tests/no_prefix/BUILD.bazel index 16281507fc..e3cf14f9d1 100644 --- a/tests/no_prefix/BUILD.bazel +++ b/tests/no_prefix/BUILD.bazel @@ -20,7 +20,6 @@ go_library( go_test( name = "go_default_xtest", srcs = ["no_prefix_test.go"], - importpath = "github.com/bazelbuild/rules_go/tests/no_prefix_test", deps = [":go_default_library"], ) diff --git a/tests/package_named_build/build/BUILD.bazel b/tests/package_named_build/build/BUILD.bazel index 6722949242..bf5931bef4 100644 --- a/tests/package_named_build/build/BUILD.bazel +++ b/tests/package_named_build/build/BUILD.bazel @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = ["build.go"], + importpath = "github.com/bazelbuild/rules_go/tests/package_named_build/build", ) go_test( diff --git a/tests/race/BUILD.bazel b/tests/race/BUILD.bazel index 74f5e18a7a..33a42285dc 100644 --- a/tests/race/BUILD.bazel +++ b/tests/race/BUILD.bazel @@ -5,6 +5,7 @@ load(":generate_test.bzl", "generate_script") go_library( name = "go_default_library", srcs = ["race.go"], + importpath = "github.com/bazelbuild/rules_go/tests/race", deps = ["//tests/race/racy:go_default_library"], ) diff --git a/tests/race/racy/BUILD.bazel b/tests/race/racy/BUILD.bazel index a47ef309e3..5e2075af22 100644 --- a/tests/race/racy/BUILD.bazel +++ b/tests/race/racy/BUILD.bazel @@ -3,5 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["racy.go"], + importpath = "github.com/bazelbuild/rules_go/tests/race/racy", visibility = ["//visibility:public"], ) diff --git a/tests/reproducible_binary/BUILD.bazel b/tests/reproducible_binary/BUILD.bazel index 966c87fc91..a84a8349f3 100644 --- a/tests/reproducible_binary/BUILD.bazel +++ b/tests/reproducible_binary/BUILD.bazel @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") go_library( name = "go_default_library", srcs = ["hello.go"], + importpath = "github.com/bazelbuild/rules_go/tests/reproducible_binary", visibility = ["//visibility:private"], ) diff --git a/tests/slash_names/BUILD.bazel b/tests/slash_names/BUILD.bazel index 4270d5076b..ce7d8fd993 100644 --- a/tests/slash_names/BUILD.bazel +++ b/tests/slash_names/BUILD.bazel @@ -7,11 +7,13 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "a/pkg", srcs = ["a/pkg/pkg.go"], + importpath = "github.com/bazelbuild/rules_go/tests/slash_names/a/pkg", ) go_library( name = "b/pkg", srcs = ["b/pkg/pkg.go"], + importpath = "github.com/bazelbuild/rules_go/tests/slash_names/b/pkg", ) go_test( diff --git a/tests/test_build_constraints/BUILD.bazel b/tests/test_build_constraints/BUILD.bazel index 2214d9a1d1..b66eb43852 100644 --- a/tests/test_build_constraints/BUILD.bazel +++ b/tests/test_build_constraints/BUILD.bazel @@ -21,4 +21,5 @@ go_library( "baz_linux_test.go", "baz_unknown_test.go", ], + importpath = "github.com/bazelbuild/rules_go/tests/test_build_constraints", ) diff --git a/tests/test_chdir/BUILD.bazel b/tests/test_chdir/BUILD.bazel index 40b696c2a6..7e06b0ed34 100644 --- a/tests/test_chdir/BUILD.bazel +++ b/tests/test_chdir/BUILD.bazel @@ -5,7 +5,6 @@ go_test( size = "small", srcs = ["data_test.go"], data = ["data.txt"], - importpath = "test_chdir/sub", ) test_suite( diff --git a/tests/trans_dep_error/BUILD.bazel b/tests/trans_dep_error/BUILD.bazel index d3d281ca82..cdf5766a5d 100644 --- a/tests/trans_dep_error/BUILD.bazel +++ b/tests/trans_dep_error/BUILD.bazel @@ -1,4 +1,4 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_prefix") +load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//tests:bazel_tests.bzl", "bazel_test") bazel_test( @@ -15,11 +15,10 @@ fi targets = [":go_default_library"], ) -go_prefix("github.com/bazelbuild/rules_go/tests/trans_dep_error") - go_library( name = "go_default_library", srcs = ["lib.go"], + importpath = "github.com/bazelbuild/rules_go/tests/trans_dep_error", tags = ["manual"], deps = [":a"], ) @@ -28,9 +27,11 @@ go_library( name = "a", srcs = ["a.go"], deps = [":b"], + importpath = "github.com/bazelbuild/rules_go/tests/trans_dep_error/a", ) go_library( name = "b", srcs = ["b.go"], + importpath = "github.com/bazelbuild/rules_go/tests/trans_dep_error/b", ) diff --git a/tests/transitive_data/BUILD.bazel b/tests/transitive_data/BUILD.bazel index 9f96226a52..32873ebd71 100644 --- a/tests/transitive_data/BUILD.bazel +++ b/tests/transitive_data/BUILD.bazel @@ -24,6 +24,7 @@ go_library( "cgo_data.txt", "go_data.txt", ], + importpath = "github.com/bazelbuild/rules_go/tests/transitive_data", ) cc_library(