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/go: doc confused by $GOPATH/src/mod #26635

Closed
rsc opened this issue Jul 27, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@rsc
Copy link
Contributor

commented Jul 27, 2018

Rob points out that go doc is walking GOPATH and gets confused.

@rsc rsc added this to the Go1.11 milestone Jul 27, 2018

@flibustenet

This comment has been minimized.

Copy link

commented Jul 27, 2018

There are many others tools that gets confused with src/mod. Simply each find and grep that we want to run and that will need to exclude mod.
I understand that you don't want to add $GOPATH/mod for people who set $GOPATH=~ but maybe $GOPATH will be more and more useless and less and less =~.
What about an env $GOMODCACHE ? It could be fine to set one $GOMODCACHE for all projects, or decide one for each project (easy to clean), one for group of project... Can be by default in $GOPATH since GOPATH by default is not ~.
I didn't fill a new issue, quite sure that there is already one of this topic ?

@gopherbot

This comment has been minimized.

Copy link

commented Jul 30, 2018

Change https://golang.org/cl/126755 mentions this issue: cmd/go: move module cache from $GOPATH/src/mod to $GOPATH/pkg/mod

@gopherbot

This comment has been minimized.

Copy link

commented Jul 31, 2018

Change https://golang.org/cl/126799 mentions this issue: cmd/doc: adapt directory search for modules

@gopherbot gopherbot closed this in b8f42d7 Aug 1, 2018

gopherbot pushed a commit that referenced this issue Aug 1, 2018

cmd/doc: adapt directory search for modules
Previously, cmd/doc treated GOROOT/src and GOPATH/src
as the roots of the directory trees holding packages, assuming
that the import path would be the path elements after the src directory.

With modules, each module serves as its own root of a file tree,
and the import path prefix starts with the module path before
adding the path elements after the module root.

There are ways we could make this more efficient,
but for now this is a fairly small adjustment to get 'go doc'
working OK for modules for Go 1.11.

Fixes #26635.

Change-Id: Ifdee4194601312846c7b1fc67f2fe7a4a44269cc
Reviewed-on: https://go-review.googlesource.com/126799
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.