Skip to content

Commit 5d733ef

Browse files
committed
godoc: fix crash in -analysis
Fixes golang/go#20641 Change-Id: I499b4b8da2899c4b606ce3eedd30caab57607a85 Reviewed-on: https://go-review.googlesource.com/45570 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
1 parent 011098b commit 5d733ef

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

godoc/analysis/analysis.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ type analysis struct {
299299
result *Result
300300
prog *ssa.Program
301301
ops []chanOp // all channel ops in program
302-
allNamed []*types.Named // all named types in the program
302+
allNamed []*types.Named // all "defined" (formerly "named") types in the program
303303
ptaConfig pointer.Config
304304
path2url map[string]string // maps openable path to godoc file URL (/src/fmt/print.go)
305305
pcgs map[*ssa.Package]*packageCallGraph
@@ -475,7 +475,9 @@ func Run(pta bool, result *Result) {
475475
for _, info := range iprog.AllPackages {
476476
for _, obj := range info.Defs {
477477
if obj, ok := obj.(*types.TypeName); ok {
478-
a.allNamed = append(a.allNamed, obj.Type().(*types.Named))
478+
if named, ok := obj.Type().(*types.Named); ok {
479+
a.allNamed = append(a.allNamed, named)
480+
}
479481
}
480482
}
481483
}

0 commit comments

Comments
 (0)