-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: go mod vendor does not produce a consistent modules.txt #28102
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
Comments
Different in what way? (Which modules were transposed, and does one of them transitively depend on the other?) |
Change https://golang.org/cl/140862 mentions this issue: |
It appears that the BuildList itself is sorted. If there is any nondeterminism, it likely comes from concurrent import scanning, but I haven't been able to reproduce it in a unit-test so far. |
I'll work on a reproducer for this today. If it helps you, it seems to occur for me when I use |
Ah. If you repeatedly run |
Yes, I think I do. I'll attempt to verify with an example on a public repo when I can today or at least get more information on the difference in the private repo. |
I tried to produce a test to reproduce this and I found a combination of user-failure/a potentially additional command as needed. The reason why I got the failure is because as part of CI, we were doing this:
When I copy vendor to another directory, it becomes part of the current project in some way and it starts resolving all of the vendored dependencies as if they were part of the current project. So I think my initial issue is wrong as that's user failure. But, the reason why we do that is because in our CI, the place where we run that doesn't have git. We commit our vendor directory and we want to ensure our vendor directory is correctly committed. Our CI doesn't have git at this point, so I copied the vendor directory to contain it. It doesn't appear like there's a way to validate the vendor directory similar to Am I missing a command or should I create a separate issue for that? |
From
|
I think that's #27348. |
Closing, on the theory that @mark-rushakoff's workaround should address your immediate needs and #27348 should provide a longer-term solution. Please let me know if there are any other parts that we need to keep track of. |
Updates #28102 Change-Id: Iee1ff64c7720108d6d26bfbff60ea51877093960 Reviewed-on: https://go-review.googlesource.com/c/140862 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
What did you do?
Ran
go mod vendor
and committed the results to source control. Then ran it in continuous integration by copying the folder, runninggo mod vendor
, and diffing the folders withdiff -qr vendor.orig/ vendor/
to find differences.What did you expect to see?
I expected to see no differences.
What did you see instead?
There were many differences. Running
diff -qr <(sort vendor.orig/modules.txt) <(sort vendor/modules.txt)
caused it to report no differences between the files, so it appears the ordering was different.System details
The text was updated successfully, but these errors were encountered: