Skip to content

Commit 6a42fa8

Browse files
Paolo Tranquillimbg
authored andcommitted
Go: add patch for go 1.23 windows build problem
1 parent bea18b3 commit 6a42fa8

File tree

5 files changed

+110
-1
lines changed

5 files changed

+110
-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.10")
18-
bazel_dep(name = "rules_go", version = "0.49.0")
18+
bazel_dep(name = "rules_go", version = "0.49.0-codeql.1")
1919
bazel_dep(name = "rules_pkg", version = "0.10.1")
2020
bazel_dep(name = "rules_nodejs", version = "6.2.0-codeql.1")
2121
bazel_dep(name = "rules_python", version = "0.32.2")
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
module(
2+
name = "rules_go",
3+
version = "0.49.0-codeql.1",
4+
compatibility_level = 0,
5+
repo_name = "io_bazel_rules_go",
6+
)
7+
8+
# The custom repo_name is used to prevent our bazel_features polyfill for WORKSPACE builds from
9+
# conflicting with the real bazel_features repo.
10+
bazel_dep(name = "bazel_features", version = "1.9.1", repo_name = "io_bazel_rules_go_bazel_features")
11+
bazel_dep(name = "bazel_skylib", version = "1.2.0")
12+
bazel_dep(name = "platforms", version = "0.0.10")
13+
bazel_dep(name = "rules_proto", version = "6.0.0")
14+
bazel_dep(name = "protobuf", version = "3.19.2", repo_name = "com_google_protobuf")
15+
16+
go_sdk = use_extension("//go:extensions.bzl", "go_sdk")
17+
go_sdk.download(
18+
name = "go_default_sdk",
19+
version = "1.21.8",
20+
)
21+
use_repo(
22+
go_sdk,
23+
"go_toolchains",
24+
# This name is ugly on purpose to avoid a conflict with a user-named SDK.
25+
"io_bazel_rules_nogo",
26+
)
27+
28+
register_toolchains("@go_toolchains//:all")
29+
30+
bazel_dep(name = "gazelle", version = "0.36.0")
31+
32+
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
33+
go_deps.from_file(go_mod = "//:go.mod")
34+
use_repo(
35+
go_deps,
36+
"com_github_gogo_protobuf",
37+
"com_github_golang_mock",
38+
"com_github_golang_protobuf",
39+
"org_golang_google_genproto",
40+
"org_golang_google_grpc",
41+
"org_golang_google_grpc_cmd_protoc_gen_go_grpc",
42+
"org_golang_google_protobuf",
43+
"org_golang_x_net",
44+
"org_golang_x_tools",
45+
# Exported by gazelle specifically for rules_go.
46+
"bazel_gazelle_go_repository_config",
47+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Taken from https://github.com/bazelbuild/rules_go/pull/4050/commits/55b4c07d3244c829c11f297335550f19fcc718bd
2+
diff --git a/go/private/context.bzl b/go/private/context.bzl
3+
index ad0270fe..0243a231 100644
4+
--- a/go/private/context.bzl
5+
+++ b/go/private/context.bzl
6+
@@ -439,6 +439,14 @@ def go_context(
7+
#
8+
# See https://go.dev/doc/toolchain for more info.
9+
"GOTOOLCHAIN": "local",
10+
+
11+
+ # NOTE(#4049): Since Go 1.23.0, os.Readlink (and consequently
12+
+ # filepath.EvalSymlinks) stopped treating Windows mount points and
13+
+ # reparse points (junctions) as symbolic links. Bazel uses junctions
14+
+ # when constructing exec roots, and we use filepath.EvalSymlinks in
15+
+ # GoStdlib, so this broke us. Setting GODEBUG=winsymlink=0 restores
16+
+ # the old behavior.
17+
+ "GODEBUG": "winsymlink=0",
18+
}
19+
20+
# Path mapping can't map the values of environment variables, so we pass GOROOT to the action
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"integrity": "sha256-2T7wLx5yyC2Ls9UWlRmzYWezPPaMJSUl47nT1d0UPec=",
3+
"strip_prefix": "",
4+
"url": "https://github.com/bazelbuild/rules_go/releases/download/v0.49.0/rules_go-v0.49.0.zip",
5+
"patches": {
6+
"disable_winsymlink.patch": "sha256-o2DWpbkv9TK80evwEQCdDFSXGLlgoT5BZg7MnvE77Go="
7+
},
8+
"patch_strip": 1
9+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"homepage": "https://github.com/bazelbuild/rules_go",
3+
"maintainers": [
4+
{
5+
"email": "fabian@meumertzhe.im",
6+
"github": "fmeum",
7+
"name": "Fabian Meumertzheim"
8+
},
9+
{
10+
"email": "zplin@uber.com",
11+
"github": "linzhp",
12+
"name": "Zhongpeng Lin"
13+
},
14+
{
15+
"email": "tfrench@uber.com",
16+
"github": "tyler-french",
17+
"name": "Tyler French"
18+
}
19+
],
20+
"repository": [
21+
"github:bazelbuild/rules_go"
22+
],
23+
"versions": [
24+
"0.49.0-codeql.1"
25+
],
26+
"yanked_versions": {
27+
"0.33.0": "Obsolete experimental version that emits debug prints. Update to 0.39.1 or higher",
28+
"0.34.0": "Obsolete experimental version that emits debug prints. Update to 0.39.1 or higher",
29+
"0.35.0": "Obsolete experimental version that emits debug prints. Update to 0.39.1 or higher",
30+
"0.36.0": "Obsolete experimental version that emits debug prints. Update to 0.39.1 or higher",
31+
"0.37.0": "Obsolete experimental version that emits debug prints. Update to 0.39.1 or higher"
32+
}
33+
}

0 commit comments

Comments
 (0)