-
Notifications
You must be signed in to change notification settings - Fork 377
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
Can't import "golang.org/x/exp/slices" #1468
Comments
@hulkholden the issue is that older versions of in my case, I've done it with gazelle:
|
Update: - golang.org/x/exp v0.0.0-20190121172915-509febef88a4 -> v0.0.0-20230713183714-613f0c0eb8a1 - golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be -> v0.10.0 These were very old dependencies and there is no way to override them to newer ones by Gazelle user. 1. You cannot execute go_repository before calling gazelle_dependencies as @bazel_gazelle_go_repository_cache is not yet ready. 2. If you execute go_repository AFTER calling gazelle_dependences, the previously loaded old verision by gazelle_dependencies takes precendence. It led to issues like: - bazelbuild#1468 - https://stackoverflow.com/questions/64929217/bazel-gazelle-error-no-such-package-org-golang-x-tools-go-analysis-internal Fixes: bazelbuild#1468
- gazelle_init() - gazelle_go_repositories() Thanks to it, the caller can call go_repository in between, loading their own (likely newer) version of the dependencies. Currently `go_repository` cannot be called before `gazelle_dependencies`, as the `bazel_gazelle_go_repository_cache` is not yet initialized. Fixes problems like: - bazelbuild#1582 - bazelbuild#1468 - bazelbuild#1305 -
Update: - golang.org/x/exp v0.0.0-20190121172915-509febef88a4 -> v0.0.0-20230713183714-613f0c0eb8a1 - golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be -> v0.10.0 These were very old dependencies and there is no way to override them to newer ones by Gazelle user. 1. You cannot execute go_repository before calling gazelle_dependencies as @bazel_gazelle_go_repository_cache is not yet ready. 2. If you execute go_repository AFTER calling gazelle_dependences, the previously loaded old verision by gazelle_dependencies takes precendence. It led to issues like: - #1468 - https://stackoverflow.com/questions/64929217/bazel-gazelle-error-no-such-package-org-golang-x-tools-go-analysis-internal Fixes: #1468 Co-authored-by: Zhongpeng Lin <zplin@uber.com>
@tyler-french Was the downgrade of the |
@Multiply You could add the contents of the reverted commit as a patch to your |
The overall issue for us isn't tied to x/exp, but rather latest version of x/exp updating x/tools as well, from the looks of it. |
@fmeum It was not. I just ran the releaser. I am a bit concerned because it looks like other deps were also changed. Maybe there was some mistake I made while rebasing |
Update: - golang.org/x/exp v0.0.0-20190121172915-509febef88a4 -> v0.0.0-20230713183714-613f0c0eb8a1 - golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be -> v0.10.0 These were very old dependencies and there is no way to override them to newer ones by Gazelle user. 1. You cannot execute go_repository before calling gazelle_dependencies as @bazel_gazelle_go_repository_cache is not yet ready. 2. If you execute go_repository AFTER calling gazelle_dependences, the previously loaded old verision by gazelle_dependencies takes precendence. It led to issues like: - bazelbuild#1468 - https://stackoverflow.com/questions/64929217/bazel-gazelle-error-no-such-package-org-golang-x-tools-go-analysis-internal Fixes: bazelbuild#1468 Co-authored-by: Zhongpeng Lin <zplin@uber.com>
What version of gazelle are you using?
v0.29.0
What version of rules_go are you using?
v0.38.1
What version of Bazel are you using?
Does this issue reproduce with the latest releases of all the above?
Yes.
What operating system and processor architecture are you using?
macOS Venture 13.2, Apple M2 Max.
What did you do?
See https://github.com/hulkholden/gazellerepro. I'm trying to import "golang.org/x/exp/slices". If
gazelle_dependencies
appears beforeload("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
in my WORKSPACE.bazel, gazelle doesn't seem to generate a BUILD file for the slices subdirectory. This sounds a bit like #104 which is how I figured out to fix the problem by reordering things.What did you expect to see?
Successful build OR a useful error message. At the very least it would have been nice to see a warning like "encountered legacy rule in X, flipping to legacy mode" if that's what's going on.
What did you see instead?
no such package '@org_golang_x_exp//slices': BUILD file not found in directory 'slices' of external repository @org_golang_x_exp. Add a BUILD file to a directory to mark it as a package. and referenced by '//:gazellerepro_lib'
The text was updated successfully, but these errors were encountered: