-
-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
amd64 v3 platform is broken in recent releases #4119
Comments
Could you share a reproducer that doesn't require rules_oci? That will greatly simplify the effort needed to debug this and can also serve as an integration test for the fix. |
@fmeum thanks, here's a minimal example:
bazel_dep(name = "rules_go", version = "0.50.1")
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.23.1")
load("@rules_go//go:def.bzl", "go_library")
platform(
name = "amd64_v3",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
"@rules_go//go/constraints/amd64:v3",
],
)
go_library(
name = "test_lib",
srcs = [
"main.go",
],
importpath = "github.com/fishy/test",
visibility = ["//visibility:private"],
)
package main
import (
"fmt"
"os"
"time"
)
func main() {
fmt.Println(time.Now())
os.Exit(0)
}
module github.com/fishy/test
go 1.23
|
looks like 0.48.1 is the last version this works. 0.49.0 gives the same error I'm seeing now with 0.50.1. |
The diff --git a/go/private/context.bzl b/go/private/context.bzl
index d2e0c653..db28e5c2 100644
--- a/go/private/context.bzl
+++ b/go/private/context.bzl
@@ -508,12 +508,6 @@ def go_context(
"GODEBUG": "winsymlink=0",
}
- # Path mapping can't map the values of environment variables, so we pass GOROOT to the action
- # via an argument instead in builder_args. We need to drop it from the environment to get cache
- # hits across different configurations since the stdlib path typically contains a Bazel
- # configuration segment.
- env_for_path_mapping = {k: v for k, v in env.items() if k != "GOROOT"}
-
# The level of support is determined by the platform constraints in
# //go/constraints/amd64.
# See https://go.dev/wiki/MinimumRequirements#amd64
@@ -525,6 +519,12 @@ def go_context(
if mode.arm:
env["GOARM"] = mode.arm
+ # Path mapping can't map the values of environment variables, so we pass GOROOT to the action
+ # via an argument instead in builder_args. We need to drop it from the environment to get cache
+ # hits across different configurations since the stdlib path typically contains a Bazel
+ # configuration segment.
+ env_for_path_mapping = {k: v for k, v in env.items() if k != "GOROOT"}
+
if cgo_context_info:
env.update(cgo_context_info.env)
cc_toolchain_files = cgo_context_info.cc_toolchain_files I'm going to push a PR with this modification, |
What version of rules_go are you using?
0.50.1
What version of gazelle are you using?
0.39.0
What version of Bazel are you using?
7.3.1
Does this issue reproduce with the latest releases of all the above?
Those are the latest releases
What operating system and processor architecture are you using?
linux/amd64
Any other potentially useful information about your toolchain?
What did you do?
We recently upgraded the bzlmod dependencies. Before:
After
We have
amd64_v3
platform defined in top levelBUILD.bazel
as:And this defined in
.bazelrc
:And for docker images, we have these rules:
And we just run this to push the amd64_v3 image:
But after the bzlmod updates, it starts to give this error:
(the error is a few different source go files with different stdlib imports, this is just one example)
I tried to revert rules_oci back to 1.7.6 but got the same error, so I think this is introduced by new version of rules_go not new version of rules_oci.
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: