diff --git a/cmd/pkger/cmds/pack.go b/cmd/pkger/cmds/pack.go index d09792b..bc056a9 100644 --- a/cmd/pkger/cmds/pack.go +++ b/cmd/pkger/cmds/pack.go @@ -125,6 +125,11 @@ func (e *packCmd) Flags() *flag.FlagSet { func Package(out string, decls parser.Decls) error { os.RemoveAll(out) + defer func() { + if err := recover(); err != nil { + os.RemoveAll(out) + } + }() f, err := os.Create(out) if err != nil {