diff options
author | Rob Findley <rfindley@google.com> | 2021-06-03 09:52:05 -0400 |
---|---|---|
committer | Cherry Mui <cherryyz@google.com> | 2021-09-01 22:31:06 +0000 |
commit | 678b07d5e513a8bbe6780475e88bd92ed1b7b28a (patch) | |
tree | d69f793e72056ad756801f1bd20e1d808e0d3958 | |
parent | 14c9b1e00b35f9b27f2edd1203bdc60a08b62c5e (diff) | |
download | go-678b07d5e513a8bbe6780475e88bd92ed1b7b28a.tar.gz go-678b07d5e513a8bbe6780475e88bd92ed1b7b28a.zip |
[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 e32fab145b488cf8bd1fb4a2466cb9be33ac3770)
Reviewed-on: https://go-review.googlesource.com/c/go/+/347071
-rw-r--r-- | src/go/types/resolver.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/go/types/resolver.go b/src/go/types/resolver.go index 114647a2ff..4892218b75 100644 --- a/src/go/types/resolver.go +++ b/src/go/types/resolver.go @@ -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 } |