Commit b744a11a authored by Daniel Martí's avatar Daniel Martí Committed by Robert Griesemer

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/38262Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
parent ed00cd94
......@@ -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)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment