]> Cypherpunks repositories - gostls13.git/commit
go/types: remove invalid documentation and assertion on package names
authorRobert Griesemer <gri@golang.org>
Fri, 5 May 2017 20:57:22 +0000 (13:57 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 5 May 2017 23:03:50 +0000 (23:03 +0000)
commit2eeaba4172522783f30440bf6e11f7f865116024
tree547c57ec5f59f32c97d5f0db033e69a383ddef1f
parent0e7518296d04977db0c71e2f326d473782973739
go/types: remove invalid documentation and assertion on package names

NewPackage required through documentation that the package name not
be blank (which wasn't true since each time we check a new package
we create one with a blank name (api.go:350). NewPackage also asserted
that a package name not be "_". While it is invalid for a package name
to be "_", one could conceivably create a package named "_" through
export data manipulation. Furthermore, it is ok to import a package
with package path "_" as long as the package itself is not named "_".

- removed misleading documentation
- removed unnecessary assertion
- added safety checks when we actually do the import

Fixes #20231.

Change-Id: I1eb1ab7b5e3130283db715374770cf05d749d159
Reviewed-on: https://go-review.googlesource.com/42852
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
src/go/types/package.go
src/go/types/resolver.go