go/doc,x/pkgsite: struct fields inconsistently linked in doc comments #61394
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
pkgsite
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
https://go.dev/doc/comment#doclinks currently says:
but it is somewhat ambiguous about whether the
[Name1.Name2]
form can refer to struct fields or only methods.In practice, people do seem to intuitively expect references to struct fields to work; for example, this comment on

types.Package.GoVersion
(written by @rsc) refers to thego/ast.File.GoVersion
struct field, andpkg.go.dev
appears to render that reference correctly:However, similar references within the same package are not rendered as links. For example, the reference to

[CheckedFiles.SizeError]
fromzip.CheckedFiles.Err
is currently rendered as plain text:go/doc.Parser
uses different functions to resolve intra- vs. inter-package references: it appears that theLookupPackage
hook being used bypkgsite
does resolve struct fields, whereas theLookupSym
hook does not.The text was updated successfully, but these errors were encountered: