-
Notifications
You must be signed in to change notification settings - Fork 385
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
new gazelle v0.36.0 fails with Go sum mismatches #1774
Comments
Might be related to: #1755 |
@scaiper Do you happen to see why this particular module would result in a different hash? |
I've tried this exact version with sum = "h1:edOeKOW2eGP8j3gI6wQWzyoUM0njjuxOlbtpguIkXqQ=" and it worked. But we use Bzlmod, maybe there are some differences. |
Can you confirm that this issue still occurs after |
Are you using either |
We're only noticing this in a very specific environment, so we may be doing something weird. Will follow-up |
(cc @linzhp) It looks like the reason this is happening is because of our "sparse checkout" tooling. We have a feature to be able to checkout only a small part of our Monorepo (and all it's required deps, including external deps), which we copy over from a "full" work tree. In this case, it looks like the sum of the downloaded archive matches the SUM in the |
To be precise, it's not a build time verification. Verification is done in repository rule right after downloading and coping module to final location. |
Hmm, it does look like we are using a local GOMODCACHE. I am curious if/why this would be getting corrupted. |
Created this PR: #1782 If we start verifying them, I think it would be good to let them know that this might be the failure cause. |
This failure was confusing to our users. We should make more clear error messages in cases when a `GOMODCACHE` might be corrupt. Resolves #1774 Example failure: ``` ERROR: /home/user/go-code/WORKSPACE:69:26: fetching go_repository rule //external:com_github_bazelbuild_remote_apis: Traceback (most recent call last): File "/home/user/.cache/bazel/_bazel_tfrench/b97476d719d716accead0f2d5b93104f/external/bazel_gazelle/internal/go_repository.bzl", line 263, column 17, in _go_repository_impl fail("failed to fetch %s: %s" % (ctx.name, result.stderr)) Error in fail: failed to fetch com_github_bazelbuild_remote_apis: fetch_repo: resulting module with sum h1:xhO5v3Ac039HesaPqoVUwOy4WhRRJbmo9om245kp+AY=; expected sum h1:xhO5v3Ac039HesaPqoVUwOy4WhRRJbmo9om245kp+AY=, Please try clearing your module cache directory "/home/user/go-code/pkg/mod" ERROR: Error computing the main repository mapping: no such package '@@com_github_bazelbuild_remote_apis//': failed to fetch com_github_bazelbuild_remote_apis: fetch_repo: resulting module with sum h1:xhO5v3Ac039HesaPqoVUwOy4WhRRJbmo9om245kp+AY=; expected sum h1:xhO5v3Ac039HesaPqoVUwOy4WhRRJbmo9om245kp+AY=, Please try clearing your module cache directory "/home/user/go-code/pkg/mod" INFO: Build Event Protocol files produced successfully. Computing main repo mapping: WARNING:Bazel failed with exit code 1 ```
What version of gazelle are you using?
https://github.com/bazelbuild/bazel-gazelle/releases/tag/v0.36.0
What version of rules_go are you using?
https://github.com/bazelbuild/rules_go/releases/tag/v0.46.0
What version of Bazel are you using?
7.1.1
Does this issue reproduce with the latest releases of all the above?
Yes
What operating system and processor architecture are you using?
Linux AMD 64
What did you do?
Darwin ARM 64
What did you expect to see?
Successful gazelle run
What did you see instead?
However this is a pretty normal
go_repository
rule:The text was updated successfully, but these errors were encountered: