What version of Go are you using (go version)?

$ go version
go version go1.19rc2 linux/amd64

Does this issue reproduce with the latest release?

Yes, built just now from master.

Build information
$ go version -m `which pkgsite`
/home/lotus/go/bin/pkgsite: go1.19rc2
    path    golang.org/x/pkgsite/cmd/pkgsite
    mod golang.org/x/pkgsite    v0.0.0-20220719173606-91f9f1ec61b0  h1:FmY21DBXfR9RB4OHHxkh6/zTHQHNb37BFerTKlLkLOg=
    dep cloud.google.com/go v0.99.0 h1:y/cM2iqGgGi5D5DQZl6D9STN/3dR/Vx5Mp8s752oJTY=
    dep cloud.google.com/go/cloudtasks  v1.0.0  h1:087lrtubHYhq4hdL8EN+xIdwprH9fx36XXCf6R/ZxLQ=
    dep cloud.google.com/go/container   v1.0.0  h1:k3IMcHEEJR4pQmj4/gNeUuA4azhW7i2RPX8xGhyneZw=
    dep cloud.google.com/go/errorreporting  v0.1.0  h1:z40EhrjRspplwbpO+9DSnC4kgDokBi94T/gYwtdKL5Q=
    dep cloud.google.com/go/logging v1.4.2  h1:Mu2Q75VBDQlW1HlBMjTX4X84UFR73G1TiLlRYc/b7tA=
    dep cloud.google.com/go/monitoring  v1.1.0  h1:ZnyNdf/XRcynMmKzRSNTOdOyYPs6G7do1l2D2hIvIKo=
    dep cloud.google.com/go/secretmanager   v1.0.0  h1:Wbw6lsRrpatsE8GVpuwYqImn+sY5DmRjaEImYPwcSMY=
    dep cloud.google.com/go/storage v1.18.2 h1:5NQw6tOn3eMm0oE8vTkfjau18kjL79FlMjy/CHTpmoY=
    dep cloud.google.com/go/trace   v1.0.0  h1:laKx2y7IWMjguCe5zZx6n7qLtREk4kyE69SXVC0VSN8=
    dep contrib.go.opencensus.io/exporter/prometheus    v0.1.0  h1:SByaIoWwNgMdPSgl5sMqM2KDE5H/ukPWBRo314xiDvg=
    dep contrib.go.opencensus.io/exporter/stackdriver   v0.13.4 h1:ksUxwH3OD5sxkjzEqGxNTl+Xjsmu3BnC/300MhSVTSc=
    dep contrib.go.opencensus.io/integrations/ocsql v0.1.4  h1:kfg5Yyy1nYUrqzyfW5XX+dzMASky8IJXhtHe0KTYNS4=
    dep github.com/Masterminds/squirrel v1.5.2  h1:UiOEi2ZX4RCSkpiNDQN5kro/XIBpSRk9iTqdIRPzUXE=
    dep github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7  h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ=
    dep github.com/aws/aws-sdk-go   v1.34.29    h1:4Yw8eC4nCXiIVmHJO5PD4oh0vI/df5o6cYTVzFV7vWA=
    dep github.com/aymerick/douceur v0.2.0  h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
    dep github.com/beorn7/perks v1.0.1  h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
    dep github.com/census-instrumentation/opencensus-proto  v0.3.0  h1:t/LhUZLVitR1Ow2YOnduCsavhwFUklBMoGVYUCqmCqk=
    dep github.com/cespare/xxhash/v2    v2.1.2  h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
    dep github.com/chris-ramon/douceur  v0.2.0  h1:IDMEdxlEUUBYBKE4z/mJnFyVXox+MjuEVDJNN27glkU=
    dep github.com/dgryski/go-rendezvous    v0.0.0-20200823014737-9f7001d12a5f  h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
    dep github.com/emirpasic/gods   v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
    dep github.com/evanw/esbuild    v0.14.10    h1:+7c1VNndl7uLLxVEeRH4rOUz0Y+nrSw8xfmE9rGtrtw=
    dep github.com/ghodss/yaml  v1.0.0  h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
    dep github.com/go-git/gcfg  v1.5.0  h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
    dep github.com/go-git/go-billy/v5   v5.3.1  h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34=
    dep github.com/go-git/go-git/v5 v5.4.2  h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4=
    dep github.com/go-redis/redis/v8    v8.11.4 h1:kHoYkfZP6+pe04aFTnhDH6GDROa5yJdHJVNxV3F46Tg=
    dep github.com/go-redis/redis_rate/v9   v9.1.2  h1:H0l5VzoAtOE6ydd38j8MCq3ABlGLnvvbA1xDSVVCHgQ=
    dep github.com/golang-migrate/migrate/v4    v4.15.1 h1:Sakl3Nm6+wQKq0Q62tpFMi5a503bgGhceo2icrgQ9vM=
    dep github.com/golang/groupcache    v0.0.0-20200121045136-8c9f03a8e57e  h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=
    dep github.com/golang/protobuf  v1.5.2  h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
    dep github.com/google/go-cmp    v0.5.6  h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
    dep github.com/google/licensecheck  v0.3.1  h1:QoxgoDkaeC4nFrtGN1jV7IPmDCHFNIVh54e5hSt6sPs=
    dep github.com/google/safehtml  v0.0.3-0.20211026203422-d6f0e11a5516    h1:pSEdbeokt55L2hwtWo6A2k7u5SG08rmw0LhWEyrdWgk=
    dep github.com/googleapis/gax-go/v2 v2.1.1  h1:dp3bWCh+PPO1zjRRiCSczJav13sBvG4UhNyVTa1KqdU=
    dep github.com/gorilla/css  v1.0.0  h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
    dep github.com/hashicorp/errwrap    v1.0.0  h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
    dep github.com/hashicorp/go-multierror  v1.1.0  h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI=
    dep github.com/hashicorp/golang-lru v0.5.1  h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
    dep github.com/imdario/mergo    v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
    dep github.com/jackc/chunkreader/v2 v2.0.1  h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
    dep github.com/jackc/pgconn v1.10.1 h1:DzdIHIjG1AxGwoEEqS+mGsURyjt4enSmqzACXvVzOT8=
    dep github.com/jackc/pgio   v1.0.0  h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE=
    dep github.com/jackc/pgpassfile v1.0.0  h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
    dep github.com/jackc/pgproto3/v2    v2.2.0  h1:r7JypeP2D3onoQTCxWdTpCtJ4D+qpKr0TxvoyMhZ5ns=
    dep github.com/jackc/pgservicefile  v0.0.0-20200714003250-2b9c44734f2b  h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg=
    dep github.com/jackc/pgtype v1.9.1  h1:MJc2s0MFS8C3ok1wQTdQxWuXQcB6+HwAm5x1CzW7mf0=
    dep github.com/jackc/pgx/v4 v4.14.1 h1:71oo1KAGI6mXhLiTMn6iDFcp3e7+zon/capWjl2OEFU=
    dep github.com/jbenet/go-context    v0.0.0-20150711004518-d14ea06fba99  h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
    dep github.com/jmespath/go-jmespath v0.4.0  h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
    dep github.com/kevinburke/ssh_config    v0.0.0-20201106050909-4977a11b4351  h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck=
    dep github.com/lann/builder v0.0.0-20180802200727-47ae307949d0  h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw=
    dep github.com/lann/ps  v0.0.0-20150810152359-62de8c46ede0  h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk=
    dep github.com/lib/pq   v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8=
    dep github.com/matttproud/golang_protobuf_extensions    v1.0.2-0.20181231171920-c182affec369    h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=
    dep github.com/microcosm-cc/bluemonday  v1.0.5  h1:cF59UCKMmmUgqN1baLvqU/B1ZsMori+duLVTLpgiG3w=
    dep github.com/mitchellh/go-homedir v1.1.0  h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
    dep github.com/prometheus/client_golang v1.7.1  h1:NTGy1Ja9pByO+xAeH/qiWnLrKtr3hJPNjaVUwnjpdpA=
    dep github.com/prometheus/client_model  v0.2.0  h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
    dep github.com/prometheus/common    v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc=
    dep github.com/prometheus/procfs    v0.6.0  h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4=
    dep github.com/russross/blackfriday/v2  v2.1.0  h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
    dep github.com/sergi/go-diff    v1.1.0  h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    dep github.com/xanzy/ssh-agent  v0.3.0  h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
    dep github.com/yuin/goldmark    v1.4.0  h1:OtISOGfH6sOWa1/qXqqAiOIAO6Z5J3AEAE18WAq6BiQ=
    dep github.com/yuin/goldmark-emoji  v1.0.1  h1:ctuWEyzGBwiucEqxzwe0SOYDXPAucOrE9NQC18Wa1os=
    dep go.opencensus.io    v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
    dep go.uber.org/atomic  v1.6.0  h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
    dep golang.org/x/crypto v0.0.0-20210921155107-089bfa567519  h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
    dep golang.org/x/mod    v0.5.1  h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=
    dep golang.org/x/net    v0.0.0-20211013171255-e13a2654a71e  h1:Xj+JO91noE97IN6F/7WZxzC5QE6yENAQPrwIYhW3bsA=
    dep golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8  h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg=
    dep golang.org/x/sync   v0.0.0-20210220032951-036812b2e83c  h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
    dep golang.org/x/sys    v0.0.0-20211210111614-af8b64212486  h1:5hpz5aRr+W1erYCL5JRhSUBJRph7l9XkNveoExlrKYk=
    dep golang.org/x/text   v0.3.7  h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
    dep golang.org/x/vuln   v0.0.0-20211104165457-3710d685f6c2  h1:NW7zCHSSPK1imIHQ2syrERqdvROo86oIxSNB10/En1E=
    dep golang.org/x/xerrors    v0.0.0-20200804184101-5ec99f83aff1  h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
    dep google.golang.org/api   v0.63.0 h1:n2bqqK895ygnBpdPDYetfy23K7fJ22wsrZKCyfuRkkA=
    dep google.golang.org/genproto  v0.0.0-20211208223120-3a66f561d7aa  h1:I0YcKz0I7OAhddo7ya8kMnvprhcWM045PmkBdMO9zN0=
    dep google.golang.org/grpc  v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM=
    dep google.golang.org/protobuf  v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
    dep gopkg.in/warnings.v0    v0.1.2  h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
    dep gopkg.in/yaml.v2    v2.4.0  h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
    build   -compiler=gc
    build   CGO_ENABLED=1
    build   CGO_CFLAGS=
    build   CGO_CPPFLAGS=
    build   CGO_CXXFLAGS=
    build   CGO_LDFLAGS=
    build   GOARCH=amd64
    build   GOOS=linux
    build   GOAMD64=v1

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/lotus/.cache/go-build"
GOENV="/home/lotus/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/lotus/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/lotus/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/lotus/go/go1.19rc2"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/lotus/go/go1.19rc2/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19rc2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/lotus/IsoWorkspace/OSS/geny/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3443694505=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Wrote this file:

package foo

// See [Foo.Foo] or [Bar.Foo] or [foo.Foo.Foo] or [foo.Bar.Foo].
const Something = "Something"

type Foo interface {
    Foo() string
}

type Bar int

func (Bar) Foo() string {
    return "Bar"
}

What did you expect to see?

All 4 ways to link local methods should work.

What did you see instead?

The short version of links to interface methods are not working: Golang go/doc, x/pkgsite/cmd/pkgsite: doc links not working for interface methods in scope

Comment From: cherrymui

cc @rsc @dmitshur

Comment From: ianlancetaylor

I think this implies that the Parser.LookupSym function is failing to find Foo.

CC @jba

Comment From: seankhliao

Or that pkgsite doesn't make the interface methods linkable

Comment From: Fryuni

Or that pkgsite doesn't make the interface methods linkable

The long form link ([foo.Foo.Foo]) works and clicking it goes to the line of the method inside the interface

Comment From: dolmen

Doc links would be very useful to document packages that heavily rely on interfaces (like database/sql/driver), but this bug is a blocker for experiencing the full doc links potential.

Comment From: dolmen

This is an issue for cmd/doc as well as the problem happens with text output from go doc. For this reason I think that this issue should be relabeled.

Demo:

Using the provided package:

$ go doc . Something
package foo // import "."

const Something = "Something"
    See [Foo.Foo] or Bar.Foo or foo.Foo.Foo or foo.Bar.Foo.

Expected:

$ go doc . Something
package foo // import "."

const Something = "Something"
    See Foo.Foo or Bar.Foo or foo.Foo.Foo or foo.Bar.Foo.

(@Fryuni's workaround also works with go doc)

Comment From: dolmen

CL 486815 (in which I add godoc links to database/sql and database/sql/driver) is somewhat dependent on this fix as linking to interface methods is very useful. The workaround [driver.NamedValueChecker.CheckNamedValue] is really more verbose than [NamedValueChecker.CheckNamedValue].

Comment From: dolmen

It seems that collectTypes in go/doc lacks code to expose methods in interfaces (as well as struct members). https://cs.opensource.google/go/go/+/refs/tags/go1.20.3:src/go/doc/doc.go;l=166

Comment From: findleyr

Let's try to fix this for Go 1.22.

Comment From: findleyr

I see these modules marked as retracted. Is that now working as intended?

(I would have assumed the modules would 404, but still see their documentation).

(sorry, wrong issue!)

Comment From: gopherbot

Change https://go.dev/cl/687395 mentions this issue: go/doc: linkify interface methods