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: go doc rsc.io/quote/v3 in module mode shows wrong import path #30778

Closed
rsc opened this issue Mar 12, 2019 · 13 comments
Closed

cmd/doc: go doc rsc.io/quote/v3 in module mode shows wrong import path #30778

rsc opened this issue Mar 12, 2019 · 13 comments
Labels
FrozenDueToAge release-blocker WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Mar 12, 2019

In module mode, in a module with rsc.io/quote/v3 as a dependency:

$ go doc rsc.io/quote/v3
package quote // import "rsc.io/quote"

Package quote collects pithy sayings.

func Concurrency() string
func GlassV3() string
func GoV3() string
func HelloV3() string
func OptV3() string
$ 

Note the import comment on the first line of output.
It should say rsc.io/quote/v3.
I do not know why it says rsc.io/quote instead.

@rsc rsc added this to the Go1.13 milestone Mar 12, 2019
@go101
Copy link

go101 commented Mar 12, 2019

It looks the specified import path doesn't work when modules feature is enabled.

@agnivade
Copy link
Contributor

/cc @robpike

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 20, 2019
@dmitshur
Copy link
Contributor

I'll be able to look into this issue.

@dmitshur
Copy link
Contributor

Actually, I can't reproduce this with Go 1.12.1 nor Go tip (at commit fd270d8):

$ cd $(mktemp -d)
$ go mod init m
go: creating new go.mod: module m
$ go get rsc.io/quote/v3
$ go doc rsc.io/quote/v3
package quote // import "rsc.io/quote/v3"

Package quote collects pithy sayings.

func Concurrency() string
func GlassV3() string
func GoV3() string
func HelloV3() string
func OptV3() string

@rsc What version of Go did you use? Where were the commands you ran before to initialize the main module?

@dmitshur dmitshur added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Mar 20, 2019
@dmitshur
Copy link
Contributor

There's a chance this is the same issue as #28992 (comment).

@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@dmitshur dmitshur reopened this Apr 20, 2019
@robpike robpike reopened this Apr 20, 2019
@agnivade agnivade removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 21, 2019
@andybons
Copy link
Member

@rsc is this still an issue? Do you have updated repro steps? Thanks.

@agnivade agnivade added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label May 21, 2019
@malisetti
Copy link

@dmitshur

$ go doc rsc.io/quote/v3
package quote // import "rsc.io/quote"

Package quote collects pithy sayings.

func HelloV3() string

I ran this on go version go1.12.6 linux/amd64 in a local module aftering go get rsc.io/quote/v3

@dmitshur
Copy link
Contributor

@mseshachalam Did you have a copy of rsc.io/quote repository in your GOPATH/src?

Can you check if commit 3b040b7 fixes it?

@malisetti
Copy link

malisetti commented Jul 15, 2019

@dmitshur I have a copy of `rsc.io/quote' at $GOPATH/src/rsc.io/quote pointing master branch at rsc/quote@5d9f230
I had to correct a syntax error at v3/quote.go

git diff v3/quote.go
diff --git a/v3/quote.go b/v3/quote.go
index 1f5f3d6..9b6071f 100644
--- a/v3/quote.go
+++ b/v3/quote.go
@@ -10,3 +10,4 @@ import "rsc.io/sampler"
 // Hello returns a greeting.
 func HelloV3() string {
        return sampler.Hello()
+}

I tested this with go 1.12.7 and observed the same behavior. Does this version of go include 3b040b7?

@dmitshur
Copy link
Contributor

Go 1.12.7 does not include it, it's currently only available on the latest master branch. You can use golang.org/dl/gotip to try it.

@malisetti
Copy link

malisetti commented Jul 16, 2019

Yeah. gotip works as expected.

seshachalamm@IMCHLT047:~/hello$ gotip doc rsc.io/quote/v3
package quote // import "rsc.io/quote/v3"

Package quote collects pithy sayings.

func Concurrency() string
func GlassV3() string
func GoV3() string
func HelloV3() string
func OptV3() string
seshachalamm@IMCHLT047:~/hello$ go doc rsc.io/quote/v3
package quote // import "rsc.io/quote"

Package quote collects pithy sayings.

func HelloV3() string

Could you please explain briefly about the changes in gotip and go 1.12.7 ?
The output is significantly different. I imagine gotip is using the tags of a library and go1.12.6 is using master branch ?

@dmitshur
Copy link
Contributor

Thanks for confirming @mseshachalam.

The change was CL 183991, you can read its commit message for details. It fixed issue #28992, which was that in some conditions, go doc was incorrectly using packages in your GOPATH workspace instead of from the appropriate module.

I imagine gotip is using the tags of a library and go1.12.6 is using master branch ?

Yes, it's now using the rsc.io/quote/v3 module (at some version as determined by your main module), instead of the v3 subdirectory of rsc.io/quote repository in your GOPATH workspace (on master branch).

@golang golang locked and limited conversation to collaborators Jul 15, 2020
@rsc rsc removed their assignment Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge release-blocker WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

8 participants