diff options
Diffstat (limited to 'loader')
-rw-r--r-- | loader/loader.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/loader/loader.go b/loader/loader.go index d10485707..6786ee533 100644 --- a/loader/loader.go +++ b/loader/loader.go @@ -418,8 +418,12 @@ func (p *Package) Check() error { packageName := p.ImportPath if p == p.program.MainPkg() { if p.Name != "main" { - // Sanity check. Should not ever trigger. - panic("expected main package to have name 'main'") + return Errors{p, []error{ + scanner.Error{ + Pos: p.program.fset.Position(p.Files[0].Name.Pos()), + Msg: fmt.Sprintf("expected main package to have name \"main\", not %#v", p.Name), + }, + }} } packageName = "main" } |