-
Notifications
You must be signed in to change notification settings - Fork 18k
go/doc: cross-package doc links don't work #56683
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
This is a difference between url paths used by pkgsite vs godoc (which was deprecated some time ago). |
I cannot figure out how to run pkgsite using my local filesystem as the source for the stdlib. When I ask for the docs for a stlib package, pkgsite downloads the stdlib from std@latest, which I guess is tip. How do I convince it to show me the docs for a CL I'm working on? |
@randall77 reading https://pkg.go.dev/golang.org/x/pkgsite/cmd/pkgsite it sounds like pointing the |
That didn't work, unfortunately. |
cc @jba |
Change https://go.dev/cl/477335 mentions this issue: |
I also use godoc to browse local code with pre-published edits and hit this issue. As #59056 suggest I tried to use pkgsite instead and it still does not work as flawlessly as godoc for local use case. @aarzilli, thanks for your patch at https://go.dev/cl/477335. I refreshed it to be applicable to recent x/tools as --- a/godoc/godoc.go
+++ b/godoc/godoc.go
@@ -348,7 +348,10 @@ func isDigit(ch rune) bool {
func comment_htmlFunc(info *PageInfo, comment string) string {
// TODO(gri) Provide list of words (e.g. function parameters)
// to be emphasized by ToHTML.
- return string(info.PDoc.HTML(comment))
+ pkg := info.PDoc
+ p := pkg.Printer()
+ p.DocLinkBaseURL = "/pkg"
+ return string(p.HTML(pkg.Parser().Parse(comment)))
}
// sanitizeFunc sanitizes the argument src by replacing newlines with and it works just ok - the links to other packages now work well. Is there any reason why the fix in https://go.dev/cl/477335 was not considered to be merged? |
We're just behind on pksite fixes. |
If I change the doc string of
(*bytes.Buffer).ReadFrom
from containingio.EOF
to containing[io.EOF]
, I expect godoc to render that with an appropriate clickable link to the documentation forio.EOF
.It renders a link but the link doesn't work. When running godoc locally on :6060, the link is
http://localhost:6060/io#EOF
when it should behttp://localhost:6060/pkg/io#EOF
.This page (the Doc links section) says it should work. In fact, this is the exact example shown for this feature.
Intra-package doc links seem to work.
@rsc
The text was updated successfully, but these errors were encountered: