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

jsonnet_go_dependencies() fails if go toolchain has already been registered #619

Open
glindstedt opened this issue Jul 25, 2022 · 3 comments · Fixed by #620
Open

jsonnet_go_dependencies() fails if go toolchain has already been registered #619

glindstedt opened this issue Jul 25, 2022 · 3 comments · Fixed by #620

Comments

@glindstedt
Copy link
Contributor

In this commit 1b7cbff jsonnet_go_dependencies() was modified to pass a version parameter to go_register_toolchains(). If a go toolchain has already been registered it results in this error:

Error in fail: go_register_toolchains: version set after go sdk rule declared (go_sdk)

And according to the docs, setting a version is disallowed if a toolchain has already been registered: https://github.com/bazelbuild/rules_go/blob/master/go/toolchains.rst#go-register-toolchains

@sparkprime
Copy link
Contributor

I wonder if the ability to not set version requires a recent version of bazel?

@jmthvt
Copy link

jmthvt commented Mar 13, 2023

As per bazelbuild/rules_go#2761 (comment), go_register_toolchains can be called with no version set if go_download_sdk is called first.

@anguslees
Copy link
Contributor

Passing an explicit None seems to be a reasonable workaround:

go_register_toolchains()

load("@google_jsonnet_go//bazel:deps.bzl", "jsonnet_go_dependencies")
jsonnet_go_dependencies(go_sdk_version = None)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants