When reporting a "cannot import package as init" error, we can't rely
on s.LocalPkgName being non-nil, as the original package's name may
already be nil.
Change-Id: Idec006780f12ee4398501d05a5b2ed13157f88ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/320490
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
}
if name == "init" {
- check.error(s.LocalPkgName, "cannot import package as init - init must be a func")
+ check.error(s, "cannot import package as init - init must be a func")
continue
}
"fixedbugs/issue42058b.go": true, // types2 doesn't report "channel element type too large"
"fixedbugs/issue4232.go": true, // types2 reports (correct) extra errors
"fixedbugs/issue43479.go": true, // ICE in iexport due to Syms from the wrong package
- "fixedbugs/issue43962.go": true, // types2 panics when importing package named "init"
"fixedbugs/issue4452.go": true, // types2 reports (correct) extra errors
"fixedbugs/issue4510.go": true, // types2 reports different (but ok) line numbers
"fixedbugs/issue5609.go": true, // types2 needs a better error message