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
x/tools/cmd/godoc: referred packages don't have link in documentation #8223
Comments
I don't think the reason for the missing link is in the (go/ast)ImportSpec: The ImportSpec has _all_ information that is available in the original source (and the original package name is not part of that - it can be "guessed" from the path, but it's not certain). The issue is likely elsewhere (go/doc perhaps). I will leave this open so you can elaborate more if you disagree. Status changed to WaitingForReply. |
I don't know the exact reason for the missing link. But i think the "original package name" information is useful, we should support it. For example: import ( myImage "github.com/chai2010/gopkg.image" ) There are three information in the import: 1. import path is "github.com/chai2010/gopkg.image". 2. original package name is "image". 3. local package name is "myImage". The ast.ImportSpec only include the "import path" and the "local package name", there is no "original package name". If there is no "local package name", we don't know the package name. import ( "github.com/chai2010/gopkg.image" // what is the package name? ) var _ = image.NewRGBA(...) // image is a package name ? |
The ast.ImportSpec does not and _cannot_ know the "original package name". The original package name is only know for certain if that package is actually imported - this is beyond the scope of the ast. See go.tools/go/types for more info. This is not a go/ast issue. Will update title. Status changed to Accepted. |
The same behavior would also good to have in the scope of x/tools/cmd/godoc, but also filed an issue for godoc.org at golang/gddo#433. |
@chai2010 - I am having a bit of trouble reproducing the issue because the repo "github.com/chai2010/gopkg.image" doesn't exist now. Do you have a sample repo or example to demonstrate the issue ? AFAI see, the scenario |
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.) |
The text was updated successfully, but these errors were encountered: