Skip to content

Commit e1d4bc0

Browse files
committed
Patch rules_go to avoid failures with Go 1.25
1 parent 06a49cb commit e1d4bc0

File tree

5 files changed

+118
-1
lines changed

5 files changed

+118
-1
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ local_path_override(
1515
# see https://registry.bazel.build/ for a list of available packages
1616

1717
bazel_dep(name = "platforms", version = "0.0.11")
18-
bazel_dep(name = "rules_go", version = "0.50.1")
18+
bazel_dep(name = "rules_go", version = "0.55.1-codeql.1")
1919
bazel_dep(name = "rules_pkg", version = "1.0.1")
2020
bazel_dep(name = "rules_nodejs", version = "6.2.0-codeql.1")
2121
bazel_dep(name = "rules_python", version = "0.40.0")
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
module(
2+
name = "rules_go",
3+
# Updated by the Publish to BCR app.
4+
version = "0.55.1-codeql.1",
5+
compatibility_level = 0,
6+
repo_name = "io_bazel_rules_go",
7+
)
8+
9+
# The custom repo_name is used to prevent our bazel_features polyfill for WORKSPACE builds from
10+
# conflicting with the real bazel_features repo.
11+
bazel_dep(name = "bazel_features", version = "1.9.1", repo_name = "io_bazel_rules_go_bazel_features")
12+
bazel_dep(name = "bazel_skylib", version = "1.2.0")
13+
bazel_dep(name = "platforms", version = "0.0.10")
14+
bazel_dep(name = "rules_proto", version = "7.0.2")
15+
bazel_dep(name = "protobuf", version = "29.0-rc2.bcr.1", repo_name = "com_google_protobuf")
16+
bazel_dep(name = "rules_shell", version = "0.3.0")
17+
18+
go_sdk = use_extension("//go:extensions.bzl", "go_sdk")
19+
# Don't depend on this repo by name, use toolchains instead.
20+
# See https://github.com/bazel-contrib/rules_go/blob/master/go/toolchains.rst
21+
go_sdk.from_file(
22+
name = "go_default_sdk",
23+
go_mod = "//:go.mod",
24+
)
25+
use_repo(
26+
go_sdk,
27+
"go_host_compatible_sdk_label",
28+
"go_toolchains",
29+
# This name is ugly on purpose to avoid a conflict with a user-named SDK.
30+
"io_bazel_rules_nogo",
31+
)
32+
33+
register_toolchains("@go_toolchains//:all")
34+
35+
bazel_dep(name = "gazelle", version = "0.36.0")
36+
37+
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
38+
go_deps.from_file(go_mod = "//:go.mod")
39+
use_repo(
40+
go_deps,
41+
"com_github_gogo_protobuf",
42+
"com_github_golang_mock",
43+
"com_github_golang_protobuf",
44+
"com_github_pmezard_go_difflib",
45+
"org_golang_google_genproto",
46+
"org_golang_google_grpc",
47+
"org_golang_google_grpc_cmd_protoc_gen_go_grpc",
48+
"org_golang_google_protobuf",
49+
"org_golang_x_net",
50+
"org_golang_x_tools",
51+
# Exported by gazelle specifically for rules_go.
52+
"bazel_gazelle_go_repository_config",
53+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git a/go/private/sdk.bzl b/go/private/sdk.bzl
2+
index 156bb25..feb55eb 100644
3+
--- a/go/private/sdk.bzl
4+
+++ b/go/private/sdk.bzl
5+
@@ -443,13 +443,13 @@ def _sdk_build_file(ctx, platform, version, experiments):
6+
ctx.file("ROOT")
7+
goos, _, goarch = platform.partition("_")
8+
9+
- pv = parse_version(version)
10+
- if pv != None and pv[1] >= 20:
11+
- # Turn off coverageredesign GOEXPERIMENT on 1.20+
12+
- # until rules_go is updated to work with the
13+
- # coverage redesign.
14+
- if not "nocoverageredesign" in experiments and not "coverageredesign" in experiments:
15+
- experiments = experiments + ["nocoverageredesign"]
16+
+ # pv = parse_version(version)
17+
+ # if pv != None and pv[1] >= 20:
18+
+ # # Turn off coverageredesign GOEXPERIMENT on 1.20+
19+
+ # # until rules_go is updated to work with the
20+
+ # # coverage redesign.
21+
+ # if not "nocoverageredesign" in experiments and not "coverageredesign" in experiments:
22+
+ # experiments = experiments + ["nocoverageredesign"]
23+
24+
ctx.template(
25+
"BUILD.bazel",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"integrity": "sha256-nXL3uJBBKK+5jUa774KtciPsn/NxjUGa+zVf3dn5SEo=",
3+
"strip_prefix": "",
4+
"url": "https://github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip",
5+
"patches": {
6+
"codeql_do_not_use_nocoverageredesign.patch": "sha256-v/eo1XWUpNLWKVAUcR/MlIYqKAGTS+2eWopxTl8lEwk="
7+
},
8+
"patch_strip": 1
9+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"homepage": "https://github.com/bazelbuild/rules_go",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"github": "fmeum",
7+
"name": "Fabian Meumertzheim",
8+
"github_user_id": 4312191
9+
},
10+
{
11+
"email": "[email protected]",
12+
"github": "linzhp",
13+
"name": "Zhongpeng Lin",
14+
"github_user_id": 98395
15+
},
16+
{
17+
"email": "[email protected]",
18+
"github": "tyler-french",
19+
"name": "Tyler French",
20+
"github_user_id": 66684063
21+
}
22+
],
23+
"repository": [
24+
"github:bazel-contrib/rules_go"
25+
],
26+
"versions": [
27+
"0.55.1-codeql.1"
28+
],
29+
"yanked_versions": {}
30+
}

0 commit comments

Comments
 (0)