-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/go: run constantly fails and suggests 'go mod tidy' #41416
Comments
Hmm this doesn't even appear to be specific to directory |
This is almost certainly a consequence of CL 251881 / #40728, and (except for the details of the error message) it's mostly working as designed. That said, we should at least give a better error message when the arguments include one or more packages outside the main module (for which CC @matloob |
As discussed offline, the main problem here is with my bad repro 😄 The repro above does not include a Thanks for taking the time to patiently discover the real cause (me)! |
I'll take a look at this. There are some changes to |
The null requirement can actually be significant, depending on what the replacement's |
@bcmills Just to confirm what you're saying, the two files below are not equivalent:
If we don't load a package from So it's correct that we report an error here, but the recommendation to run |
@jayconrod @bcmills What are the next steps on fixing this, given that it is a release blocker? |
I plan to work on this before the freeze. Should just involve fixing the error message. |
Change https://golang.org/cl/258220 mentions this issue: |
Change https://golang.org/cl/263146 mentions this issue: |
'go mod tidy' has been able to use replaced versions since CL 152739, but 'go get' failed for many of the same paths. Now that we are recommending 'go get' more aggressively due to #40728, we should make that work too. In the future, we might consider factoring out the new replacementRepo type so that 'go list' can report the new versions as well. For #41577 For #41416 For #37438 Updates #26241 Change-Id: I9140c556424b584fdd9bdd0a747842774664a7d8 Reviewed-on: https://go-review.googlesource.com/c/go/+/258220 Trust: Bryan C. Mills <bcmills@google.com> Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
As of CL 258220, the error message is now:
If the |
The |
Change https://golang.org/cl/263266 mentions this issue: |
…sions In CL 258220 I added replacement versions to the repo versions used in the modload.Query functions. The versions are computed from a map in the modfile index, which has a nondeterministic iteration order. I added a short-circuit condition to skip sorting in the (vastly common) case where no replacement versions are added. However, while cleaning up the change I accidentally deleted the line of code that sets that condition. As a result, the test of that functionality (mod_get_replaced) has been failing nondeterministically. This change fixes the condition by comparing the slices before and after adding versions, rather than by setting a separate variable. The test now passes reliably (tested with -count=200). Updates #41577 Updates #41416 Updates #37438 Updates #26241 Change-Id: I49a66a3a5510da00ef42b47f20a168de66100db6 Reviewed-on: https://go-review.googlesource.com/c/go/+/263266 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Success
What did you see instead?
cc @bcmills @jayconrod
The text was updated successfully, but these errors were encountered: