diff --git a/go/private/repositories.bzl b/go/private/repositories.bzl index f6b878a08d..dc16e06c1f 100644 --- a/go/private/repositories.bzl +++ b/go/private/repositories.bzl @@ -82,6 +82,25 @@ def go_rules_dependencies(force = False): patch_args = ["-p1"], ) + # Needed for go/tools/fetch_repo + # releaser:upgrade-dep golang tools + wrapper( + http_archive, + name = "org_golang_x_tools_go_vcs", + # v0.12.0, latest as of 2023-08-12 + urls = [ + "https://mirror.bazel.build/github.com/golang/tools/archive/refs/tags/go/vcs/v0.1.0-deprecated.zip", + "https://github.com/golang/tools/archive/refs/tags/go/vcs/v0.1.0-deprecated.zip", + ], + sha256 = "1b389268d126467105305ae4482df0189cc80a13aaab28d0946192b4ad0737a8", + strip_prefix = "tools-go-vcs-v0.1.0-deprecated/go/vcs", + patches = [ + # releaser:patch-cmd gazelle -repo_root . -go_prefix golang.org/x/tools/go/vcs -go_naming_convention import_alias + Label("//third_party:org_golang_x_tools_go_vcs-gazelle.patch"), + ], + patch_args = ["-p1"], + ) + # releaser:upgrade-dep golang sys wrapper( http_archive, diff --git a/go/tools/fetch_repo/BUILD.bazel b/go/tools/fetch_repo/BUILD.bazel index e865f6541c..7d02a549ce 100644 --- a/go/tools/fetch_repo/BUILD.bazel +++ b/go/tools/fetch_repo/BUILD.bazel @@ -11,7 +11,7 @@ go_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"], + deps = ["@org_golang_x_tools_go_vcs//:go_default_library"], ) go_test( @@ -19,5 +19,5 @@ go_test( size = "small", srcs = ["fetch_repo_test.go"], embed = [":go_default_library"], - deps = ["@org_golang_x_tools//go/vcs:go_default_library"], + deps = ["@org_golang_x_tools_go_vcs//:go_default_library"], ) diff --git a/third_party/org_golang_x_tools_go_vcs-gazelle.patch b/third_party/org_golang_x_tools_go_vcs-gazelle.patch new file mode 100644 index 0000000000..e25f76af31 --- /dev/null +++ b/third_party/org_golang_x_tools_go_vcs-gazelle.patch @@ -0,0 +1,30 @@ +diff -urN a/BUILD.bazel b/BUILD.bazel +--- a/BUILD.bazel 1970-01-01 01:00:00.000000000 +0100 ++++ b/BUILD.bazel 2023-08-12 19:21:03.606016940 +0200 +@@ -0,0 +1,26 @@ ++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") ++ ++go_library( ++ name = "vcs", ++ srcs = [ ++ "discovery.go", ++ "env.go", ++ "http.go", ++ "vcs.go", ++ ], ++ importpath = "golang.org/x/tools/go/vcs", ++ visibility = ["//visibility:public"], ++ deps = ["@org_golang_x_sys//execabs:go_default_library"], ++) ++ ++alias( ++ name = "go_default_library", ++ actual = ":vcs", ++ visibility = ["//visibility:public"], ++) ++ ++go_test( ++ name = "vcs_test", ++ srcs = ["vcs_test.go"], ++ embed = [":vcs"], ++)