From 9df04a21706c3e3b3636d20c4ce1a274ef03f61f Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Mon, 24 Sep 2018 14:41:10 +0200 Subject: [PATCH] compiler: fix panic on import errors I think this is a problem in the loader package - it doesn't seem to return errors for missing packages. --- compiler/compiler.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/compiler/compiler.go b/compiler/compiler.go index 86d51a9e..d349cbdb 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -166,8 +166,7 @@ func (c *Compiler) Parse(mainPath string) error { Compiler: "gc", // must be one of the recognized compilers BuildTags: append([]string{"tgo"}, c.BuildTags...), }, - ParserMode: parser.ParseComments, - AllowErrors: true, + ParserMode: parser.ParseComments, } config.Import("runtime") config.Import(mainPath) @@ -176,13 +175,6 @@ func (c *Compiler) Parse(mainPath string) error { return err } - // TODO: pick the error of the first package, not a random package - for _, pkgInfo := range lprogram.AllPackages { - if len(pkgInfo.Errors) != 0 { - return pkgInfo.Errors[0] - } - } - c.ir = ir.NewProgram(lprogram, mainPath) // Make a list of packages in import order.