Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
go/doc: link detection in ToHTML is misbehaving #22285
Please answer these questions before submitting your issue. Thanks!
What did you do?
Run the following commands on my machine (running macOS):
$ godoc -http :6060
navigated to http://localhost:6060/pkg/golang.org/x/tools/present and did a search for
What did you expect to see?
Valid link to
What did you see instead?
Invalid link pointing to
Does this issue reproduce with the latest release (go1.9.1)?
Yes, even on https://godoc.org/golang.org/x/tools/present.
I would not expect to see that. It's a <pre> block containing the following text:
It's just text. It happens to be in present format. But godoc can't know that it should parse the square brackets and text inside as a link.
The best it could do is link all of
Also see https://golang.org/pkg/go/doc/#ToHTML:
I think this is working as intended (except perhaps the URL matching stopping at the accented letter).
The logic for URL detection is in
A reasonable adjustment to the URL heuristic is to forbid the URL from containing an closing parenthesis as the first parenthesis of that form.
An update on what I said earlier.
Following the same logic, I'm not sure if