-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: mod tidy removes lines that build seems to need #31248
Comments
We should check for similarities with #29773. (I don't know whether it will turn out to be related, but it's a known source of missing dependencies.) |
Hit the same issue -
|
go.mod keeps getting updated on build but go mod tidy reverts these changes See golang/go#31248 (comment)
@prymitive, can you provide a more compact example, or at least compare the output of |
Narrowed down needed modules to just two:
https://gist.github.com/prymitive/9f8ac72d9a88f1704efa8ebfdf133bd1 updated to reflect that |
Change https://golang.org/cl/186537 mentions this issue: |
Change https://golang.org/cl/186557 mentions this issue: |
I found a minimal repro. A consistent reproducer requires two modules that depend on some module https://go-review.googlesource.com/c/go/+/186557/2/src/cmd/go/testdata/script/mod_indirect_tidy.txt |
Fixes #29773 Updates #31248 Change-Id: Ic1923119c8cf3a60c586df1b270c3af0c9095f29 Reviewed-on: https://go-review.googlesource.com/c/go/+/186537 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
I'm seeing an issue that looks like this on go1.12.7 . Is there anything I can do to confirm that I have a repro of this issue, or if I should file a separate bug? |
You could see if the behaviour you're seeing is fixed using gotip as described here: #33435 (comment) |
@bcmills
|
That is #34086, fixed at head. |
Thank you very much |
@vibridi If you haven’t already done so, would you mind confirming the behavior you reported is indeed fixed by using the |
@thepudds confirmed, it is fixed at head ( |
@bcmills Sorry to necropost, but I'm seeing a similar issue even with go 1.14.4. I have a package where "go mod tidy" removes an //indirect entry from go.mod, but that then causes "go build -mod=readonly" to fail with "cannot find module providing package github.com/dustin/gojson: import lookup disabled by -mod=readonly". On the other hand, running "go build" without "-mod=readonly" adds the same //indirect entries back into go.mod that "go mod tidy" just took out. Before I attempt to reduce this to a test case and file a new ticket, could you tell me if the following statement should 100% be true?
If it isn't supposed to be 100% true, is there any statement that can be made about "go mod tidy" vs. "go build -mod=readonly" that is 100% true? |
FYI, I also confirmed this behaviour running "gotip". |
@ceejatec Your statement should be true. Please open a new issue, and we'll take a look. |
@jayconrod Thanks for confirming. I've filed a new ticket #39570 with a reproducer. |
(I haven't dug into exactly what dependency is causing this or why, but I've managed to whittle the issue down to a fairly manageable no-code repro case.)
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes. I haven't checked against tip.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
main.go + go.mod gist
What did you expect to see?
A successful build of the binary.
What did you see instead?
Additional surrounding steps
Running
go build
will causego build -mod=readonly
to pass. Doing this adds lines (all marked "indirect") for:github.com/golang/mock
gopkg.in/check.v1
gopkg.in/yaml.v2
However, running
go mod tidy
on this go.mod will unceremoniously remove these added lines. Most confusingly,go mod why
doesn't seem to know why these lines are there either:The text was updated successfully, but these errors were encountered: