mirror of
https://github.com/golang/go.git
synced 2025-05-05 23:53:05 +00:00
go.tools/godoc/analysis: be defensive about files without position info (such as cgo generated files)
Also: improve log message for frontend errors without position info. LGTM=gri R=gri CC=golang-codereviews https://golang.org/cl/109100043
This commit is contained in:
parent
02dba5d1e6
commit
e436e8e4aa
@ -381,6 +381,9 @@ func Run(pta bool, result *Result) {
|
||||
for _, info := range iprog.AllPackages {
|
||||
nextfile:
|
||||
for _, f := range info.Files {
|
||||
if f.Pos() == 0 {
|
||||
continue // e.g. files generated by cgo
|
||||
}
|
||||
abs := iprog.Fset.File(f.Pos()).Name()
|
||||
// Find the root to which this file belongs.
|
||||
for _, root := range roots {
|
||||
@ -412,7 +415,8 @@ func Run(pta bool, result *Result) {
|
||||
errors[e.Pos] = append(errors[e.Pos], e.Msg)
|
||||
}
|
||||
default:
|
||||
log.Printf("Error (%T) without position: %v\n", err, err)
|
||||
log.Printf("Package %q has error (%T) without position: %v\n",
|
||||
info.Pkg.Path(), err, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user