Skip to content
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/doc: "can't compute 'all' using the vendor directory" in module mode #35224

Closed
gertcuykens opened this issue Oct 29, 2019 · 3 comments
Closed
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@gertcuykens
Copy link
Contributor

gertcuykens commented Oct 29, 2019

GO111MODULE="on" (force modules to be always on)
then cd /usr/local/go/src/cmd/go/internal/load as a example and do go doc in that specific goroot directory to get a overview of package load

% cd /usr/local/go/src/cmd/go/internal/load
% go doc
go list -m: can't compute 'all' using the vendor directory
        (Use -mod=mod or -mod=readonly to bypass.)
package load // import "cmd/go/internal/load"
Package load loads packages.
...

Can I ask a favor please that every maintainer sets there GO111MODULE="on" I have no doubt the module system is ready for prime time, but I really think we are heavily underestimating how many go tools are not ready because most of us just keep working in GOPATH not knowing we are about to hit a iceberg once we turn off GOPATH completely.

@bcmills bcmills added this to the Go1.14 milestone Oct 29, 2019
@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 29, 2019
@bcmills bcmills self-assigned this Oct 29, 2019
@bcmills bcmills changed the title cmd/go: doc using list -m: can't compute 'all' using the vendor directory cmd/doc: "can't compute 'all' using the vendor directory" in module mode Oct 29, 2019
@bcmills
Copy link
Member

bcmills commented Oct 29, 2019

This particular error is a side effect of the changes for #33848.
go list -m all has never given complete information in vendor mode; now that we're enabling module mode by default, it's important that we not implicitly drop the missing information.

So there are two underlying problems here:

  1. Integration test coverage for cmd/doc is poor, especially in module mode. (The vast majority of tests for cmd/doc are written against the unexported do function, rather than the go doc command that users actually invoke, and they set an explicit variable to force that function to run only in GOPATH mode.)

  2. go doc either needs to know about the vendor directory and its use, or needs to list packages instead of modules.

@jayconrod
Copy link
Contributor

More generally: #34750

@gopherbot
Copy link

Change https://golang.org/cl/205577 mentions this issue: cmd/doc: understand vendor directories in module mode

mnonnenmacher added a commit to oss-review-toolkit/ort that referenced this issue Apr 2, 2020
Previously the vendor modules were detected using the command

  go list -m -mod=vendor all

This is not possible with GoMod 1.14 anymore and fails with [1]:

  can't compute 'all' using the vendor directory

As a replacement use the command

  go mod vendor -v

to get the list of vendor modules [2]. This is also more accurate, as
the previous implementation wrongly included the modules
`github.com/hashicorp/go-multierror` and `golang.org/x/oauth2` in the
vendor scope.

[1] golang/go#35224 (comment)
[2] https://tip.golang.org/cmd/go/#hdr-Make_vendored_copy_of_dependencies

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@here.com>
mnonnenmacher added a commit to oss-review-toolkit/ort that referenced this issue Apr 2, 2020
Previously the vendor modules were detected using the command

  go list -m -mod=vendor all

This is not possible with GoMod 1.14 anymore and fails with [1]:

  can't compute 'all' using the vendor directory

As a replacement use the command

  go mod vendor -v

to get the list of vendor modules [2]. This is also more accurate, as
the previous implementation wrongly included the modules
`github.com/hashicorp/go-multierror` and `golang.org/x/oauth2` in the
vendor scope.

Fixes #2416.

[1] golang/go#35224 (comment)
[2] https://tip.golang.org/cmd/go/#hdr-Make_vendored_copy_of_dependencies

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@here.com>
mnonnenmacher added a commit to oss-review-toolkit/ort that referenced this issue Apr 2, 2020
Previously the vendor modules were detected using the command

  go list -m -mod=vendor all

This is not possible with GoMod 1.14 anymore and fails with [1]:

  can't compute 'all' using the vendor directory

As a replacement use the command

  go mod vendor -v

to get the list of vendor modules [2]. This is also more accurate, as
the previous implementation wrongly included the modules
`github.com/hashicorp/go-multierror` and `golang.org/x/oauth2` in the
vendor scope.

This also allows to enable to `GoModTest` on Windows again which
previously failed because AppVeyor is using GoMod 1.14.

Fixes #2416.

[1] golang/go#35224 (comment)
[2] https://tip.golang.org/cmd/go/#hdr-Make_vendored_copy_of_dependencies

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@here.com>
mnonnenmacher added a commit to oss-review-toolkit/ort that referenced this issue Apr 2, 2020
Previously the vendor modules were detected using the command

  go list -m -mod=vendor all

This is not possible with GoMod 1.14 anymore and fails with [1]:

  can't compute 'all' using the vendor directory

As a replacement use the command

  go mod vendor -v

to get the list of vendor modules [2]. This is also more accurate, as
the previous implementation wrongly included the modules
`github.com/hashicorp/go-multierror` and `golang.org/x/oauth2` in the
vendor scope.

Also add the go.sum file as part of this commit for convenience, because
although it is not required for the test, it needs to be manually deleted
after running the test otherwise.

This also allows to enable the `GoModTest` on Windows again which
previously failed because AppVeyor is using GoMod 1.14.

Fixes #2416.

[1] golang/go#35224 (comment)
[2] https://tip.golang.org/cmd/go/#hdr-Make_vendored_copy_of_dependencies

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@here.com>
mnonnenmacher added a commit to oss-review-toolkit/ort that referenced this issue Apr 2, 2020
Previously the vendor modules were detected using the command

  go list -m -mod=vendor all

This is not possible with GoMod 1.14 anymore and fails with [1]:

  can't compute 'all' using the vendor directory

As a replacement use the command

  go mod vendor -v

to get the list of vendor modules [2]. This is also more accurate, as
the previous implementation wrongly included the modules
`github.com/hashicorp/go-multierror` and `golang.org/x/oauth2` in the
vendor scope.

Also add the go.sum file as part of this commit for convenience, because
although it is not required for the test, it needs to be manually deleted
after running the test otherwise.

This also allows to enable the `GoModTest` on Windows again which
previously failed because AppVeyor is using GoMod 1.14.

Fixes #2416.

[1] golang/go#35224 (comment)
[2] https://tip.golang.org/cmd/go/#hdr-Make_vendored_copy_of_dependencies

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@here.com>
mnonnenmacher added a commit to oss-review-toolkit/ort that referenced this issue Apr 3, 2020
Previously the vendor modules were detected using the command

  go list -m -mod=vendor all

This is not possible with GoMod 1.14 anymore and fails with [1]:

  can't compute 'all' using the vendor directory

As a replacement use the command

  go mod vendor -v

to get the list of vendor modules [2]. This is also more accurate, as
the previous implementation wrongly included the modules
`github.com/hashicorp/go-multierror` and `golang.org/x/oauth2` in the
vendor scope.

Also add the go.sum file as part of this commit for convenience, because
although it is not required for the test, it needs to be manually deleted
after running the test otherwise.

This also allows to enable the `GoModTest` on Windows again which
previously failed because AppVeyor is using GoMod 1.14.

Fixes #2416.

[1] golang/go#35224 (comment)
[2] https://tip.golang.org/cmd/go/#hdr-Make_vendored_copy_of_dependencies

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@here.com>
@golang golang locked and limited conversation to collaborators Nov 5, 2020
@rsc rsc unassigned bcmills Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants