Skip to content

Commit 5206498

Browse files
authored
use carved out module for x/tools/go/vcs (#3671)
This part of golang.org/x/tools was removed from tools. The vcs code is still available in a separate module with a version marked as "deprecated". Let's use it for now.
1 parent 2e821f6 commit 5206498

File tree

3 files changed

+51
-2
lines changed

3 files changed

+51
-2
lines changed

go/private/repositories.bzl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,25 @@ def go_rules_dependencies(force = False):
8282
patch_args = ["-p1"],
8383
)
8484

85+
# Needed for go/tools/fetch_repo
86+
# releaser:upgrade-dep golang tools
87+
wrapper(
88+
http_archive,
89+
name = "org_golang_x_tools_go_vcs",
90+
# v0.12.0, latest as of 2023-08-12
91+
urls = [
92+
"https://mirror.bazel.build/github.com/golang/tools/archive/refs/tags/go/vcs/v0.1.0-deprecated.zip",
93+
"https://github.com/golang/tools/archive/refs/tags/go/vcs/v0.1.0-deprecated.zip",
94+
],
95+
sha256 = "1b389268d126467105305ae4482df0189cc80a13aaab28d0946192b4ad0737a8",
96+
strip_prefix = "tools-go-vcs-v0.1.0-deprecated/go/vcs",
97+
patches = [
98+
# releaser:patch-cmd gazelle -repo_root . -go_prefix golang.org/x/tools/go/vcs -go_naming_convention import_alias
99+
Label("//third_party:org_golang_x_tools_go_vcs-gazelle.patch"),
100+
],
101+
patch_args = ["-p1"],
102+
)
103+
85104
# releaser:upgrade-dep golang sys
86105
wrapper(
87106
http_archive,

go/tools/fetch_repo/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ go_library(
1111
srcs = ["main.go"],
1212
importpath = "github.com/bazelbuild/rules_go/go/tools/fetch_repo",
1313
visibility = ["//visibility:private"],
14-
deps = ["@org_golang_x_tools//go/vcs:go_default_library"],
14+
deps = ["@org_golang_x_tools_go_vcs//:go_default_library"],
1515
)
1616

1717
go_test(
1818
name = "go_default_test",
1919
size = "small",
2020
srcs = ["fetch_repo_test.go"],
2121
embed = [":go_default_library"],
22-
deps = ["@org_golang_x_tools//go/vcs:go_default_library"],
22+
deps = ["@org_golang_x_tools_go_vcs//:go_default_library"],
2323
)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff -urN a/BUILD.bazel b/BUILD.bazel
2+
--- a/BUILD.bazel 1970-01-01 01:00:00.000000000 +0100
3+
+++ b/BUILD.bazel 2023-08-12 19:21:03.606016940 +0200
4+
@@ -0,0 +1,26 @@
5+
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
6+
+
7+
+go_library(
8+
+ name = "vcs",
9+
+ srcs = [
10+
+ "discovery.go",
11+
+ "env.go",
12+
+ "http.go",
13+
+ "vcs.go",
14+
+ ],
15+
+ importpath = "golang.org/x/tools/go/vcs",
16+
+ visibility = ["//visibility:public"],
17+
+ deps = ["@org_golang_x_sys//execabs:go_default_library"],
18+
+)
19+
+
20+
+alias(
21+
+ name = "go_default_library",
22+
+ actual = ":vcs",
23+
+ visibility = ["//visibility:public"],
24+
+)
25+
+
26+
+go_test(
27+
+ name = "vcs_test",
28+
+ srcs = ["vcs_test.go"],
29+
+ embed = [":vcs"],
30+
+)

0 commit comments

Comments
 (0)