diff --git a/cmd/godoc/godoc_test.go b/cmd/godoc/godoc_test.go index 3b2335c180..8ab07f52ed 100644 --- a/cmd/godoc/godoc_test.go +++ b/cmd/godoc/godoc_test.go @@ -259,7 +259,7 @@ func testWeb(t *testing.T, withIndex bool) { }, }, { - path: "/search?q=notwithstanding", + path: "/search?q=ListenAndServe", match: []string{ "/src", }, diff --git a/godoc/index18.go b/godoc/index18.go index 49d5e95b92..de48cd874b 100644 --- a/godoc/index18.go +++ b/godoc/index18.go @@ -542,6 +542,10 @@ func (x *Indexer) visitSpec(kind SpotKind, spec ast.Spec) { } } + case *ast.AliasSpec: + x.visitIdent(kind, n.Name) + ast.Walk(x, n.Orig) + case *ast.ValueSpec: for _, n := range n.Names { x.visitIdent(kind, n) diff --git a/godoc/linkify18.go b/godoc/linkify18.go index 7ac0d7b513..5b9a03056d 100644 --- a/godoc/linkify18.go +++ b/godoc/linkify18.go @@ -158,6 +158,8 @@ func identModesFor(node ast.Node) map[*ast.Ident]identMode { if name := n.Name; name != nil { m[name] = identDef } + case *ast.AliasSpec: + m[n.Name] = identVal case *ast.ValueSpec: for _, n := range n.Names { m[n] = identVal diff --git a/godoc/server18.go b/godoc/server18.go index 247c9d4df3..05d824f462 100644 --- a/godoc/server18.go +++ b/godoc/server18.go @@ -427,6 +427,8 @@ func addNames(names map[string]bool, decl ast.Decl) { switch s := spec.(type) { case *ast.TypeSpec: names[s.Name.Name] = true + case *ast.AliasSpec: + names[s.Name.Name] = true case *ast.ValueSpec: for _, id := range s.Names { names[id.Name] = true diff --git a/godoc/snippet18.go b/godoc/snippet18.go index 72f15e8d7d..96c92a2291 100644 --- a/godoc/snippet18.go +++ b/godoc/snippet18.go @@ -42,6 +42,10 @@ func findSpec(list []ast.Spec, id *ast.Ident) ast.Spec { if s.Name == id { return s } + case *ast.AliasSpec: + if s.Name == id { + return s + } case *ast.ValueSpec: for _, n := range s.Names { if n == id {