From e32fab145b488cf8bd1fb4a2466cb9be33ac3770 Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Thu, 3 Jun 2021 09:52:05 -0400 Subject: [PATCH] [dev.typeparams] go/types: fix panic with nil package name This is a straightforward port of CL 320490 to go/types. Change-Id: I763c806c777f926a563d8f9384764e5b3f7f083c Reviewed-on: https://go-review.googlesource.com/c/go/+/324732 Trust: Robert Findley Run-TryBot: Robert Findley TryBot-Result: Go Bot Reviewed-by: Robert Griesemer --- src/go/types/resolver.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/go/types/resolver.go b/src/go/types/resolver.go index 114647a2fff..4892218b754 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 }