Fail earlier if Go is not available

This commit is contained in:
Federico G. Schwindt
2023-02-27 22:06:13 +00:00
committed by Ron Evans
parent ea183e9197
commit cdf785629a
+3 -3
View File
@@ -191,6 +191,9 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
lprogram, err := loader.Load(config, pkgName, config.ClangHeaders, types.Config{ lprogram, err := loader.Load(config, pkgName, config.ClangHeaders, types.Config{
Sizes: compiler.Sizes(machine), Sizes: compiler.Sizes(machine),
}) })
if err != nil {
return BuildResult{}, err
}
result := BuildResult{ result := BuildResult{
ModuleRoot: lprogram.MainPkg().Module.Dir, ModuleRoot: lprogram.MainPkg().Module.Dir,
MainDir: lprogram.MainPkg().Dir, MainDir: lprogram.MainPkg().Dir,
@@ -200,9 +203,6 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
// If there is no module root, just the regular root. // If there is no module root, just the regular root.
result.ModuleRoot = lprogram.MainPkg().Root result.ModuleRoot = lprogram.MainPkg().Root
} }
if err != nil { // failed to load AST
return result, err
}
err = lprogram.Parse() err = lprogram.Parse()
if err != nil { if err != nil {
return result, err return result, err