1
0
mirror of https://github.com/golang/go synced 2024-11-11 19:21:37 -07:00

[release-branch.go1.17] go/types: fix panic with nil package name

This is a straightforward port of CL 320490 to go/types.

Fixes #48082

Change-Id: I763c806c777f926a563d8f9384764e5b3f7f083c
Reviewed-on: https://go-review.googlesource.com/c/go/+/324732
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
(cherry picked from commit e32fab145b)
Reviewed-on: https://go-review.googlesource.com/c/go/+/347071
This commit is contained in:
Rob Findley 2021-06-03 09:52:05 -04:00 committed by Cherry Mui
parent 14c9b1e00b
commit 678b07d5e5

View File

@ -276,7 +276,7 @@ func (check *Checker) collectObjects() {
}
if name == "init" {
check.errorf(d.spec.Name, _InvalidInitDecl, "cannot import package as init - init must be a func")
check.errorf(d.spec, _InvalidInitDecl, "cannot import package as init - init must be a func")
return
}