Skip to content
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

rules_nixpkgs broken with the latest rules_go #436

Closed
DolceTriade opened this issue Oct 21, 2023 · 2 comments
Closed

rules_nixpkgs broken with the latest rules_go #436

DolceTriade opened this issue Oct 21, 2023 · 2 comments

Comments

@DolceTriade
Copy link
Contributor

Describe the bug
If you try to build a go using rules_nixpkgs and rules_go 0.42.0, the rules_go builder will panic with:

rulesGoStdlibPrefix should have been set via -X

To Reproduce
Build any go package with rules_nixpkgs and rules_go 0.42.0

Expected behavior
Not panic

Additional context

diff --git a/toolchains/go/go.bzl b/toolchains/go/go.bzl
index cb0f26a..179cd9c 100644
--- a/toolchains/go/go.bzl
+++ b/toolchains/go/go.bzl
@@ -212,6 +212,7 @@ go_sdk_build = """
 load("@{rules_go}//go/private/rules:binary.bzl", "go_tool_binary")
 load("@{rules_go}//go/private/rules:sdk.bzl", "package_list")
 load("@{rules_go}//go:def.bzl", "go_sdk")
+load("@{rules_go}//go/private:common.bzl", "RULES_GO_STDLIB_PREFIX")
 load("@{helpers}//:go_sdk.bzl", "go_sdk_for_arch")
 load(":go_version.bzl", "go_version")

@@ -237,6 +238,7 @@ filegroup(
 go_tool_binary(
     name = "builder",
     srcs = ["@{rules_go}//go/tools/builders:builder_srcs"],
+    ldflags = "-X main.rulesGoStdlibPrefix=%s"% RULES_GO_STDLIB_PREFIX,
     sdk = ":go_sdk",
 )

--
2.39.2

Fixes the issue.

bazel-contrib/rules_go@c2406b2 makes the change.

The reason this is an issue and not a PR because I'm not sure the best way to handle this change across different rules_go versions.

@malt3
Copy link
Collaborator

malt3 commented Oct 31, 2023

There is this PR but I'm also very much uncertain how to handle this breaking change #422

Also this is the same issue as #421

@DolceTriade
Copy link
Contributor Author

We can dupe this then.

@DolceTriade DolceTriade closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants