Browse Source

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.
pull/22/merge
Ayke van Laethem 6 years ago
parent
commit
9df04a2170
No known key found for this signature in database GPG Key ID: E97FF5335DFDFDED
  1. 8
      compiler/compiler.go

8
compiler/compiler.go

@ -167,7 +167,6 @@ func (c *Compiler) Parse(mainPath string) error {
BuildTags: append([]string{"tgo"}, c.BuildTags...),
},
ParserMode: parser.ParseComments,
AllowErrors: true,
}
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.

Loading…
Cancel
Save