mirror of
https://github.com/golang/go
synced 2024-09-30 09:28:33 -06:00
go/types: enforce Check path restrictions via panics
Its godoc says that path must not be empty or dot, while the existing implementation happily accepts both. Change-Id: I64766271c35152dc7adb21ff60eb05c52237e6b6 Reviewed-on: https://go-review.googlesource.com/38262 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
ed00cd94f2
commit
b744a11a96
@ -347,6 +347,9 @@ func (init *Initializer) String() string {
|
||||
// file set, and the package path the package is identified with.
|
||||
// The clean path must not be empty or dot (".").
|
||||
func (conf *Config) Check(path string, fset *token.FileSet, files []*ast.File, info *Info) (*Package, error) {
|
||||
if path == "" || path == "." {
|
||||
panic(`path must not be "" or "."`)
|
||||
}
|
||||
pkg := NewPackage(path, "")
|
||||
return pkg, NewChecker(conf, fset, pkg, info).Files(files)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user