Only CompilePackage if pkg!=nil
If there's a problem loading the package metadata, we shouldn't attempt
to compile it afterwards.  Instead, just fall through, and exit cleanly.
@@ -54,7 +54,7 @@ func newCompileCmd() *cobra.Command {
mugl = comp.Compile()
} else {
fn := args[0]
- pkg := cmdutil.ReadPackageFromArg(fn)
+ if pkg := cmdutil.ReadPackageFromArg(fn); pkg != nil {
var comp compiler.Compiler
var err error
if fn == "-" {
@@ -67,6 +67,7 @@ func newCompileCmd() *cobra.Command {
}
mugl = comp.CompilePackage(pkg)
}
+ }
if mugl == nil {
return
}
