fix embed not working with -o

This commit is contained in:
Nicolas Lepage 2019-11-11 23:20:19 +01:00
parent c69a63df8d
commit b97aa787b5
No known key found for this signature in database
GPG Key ID: B0879E35E66D8F6F
1 changed files with 3 additions and 3 deletions

View File

@ -53,7 +53,7 @@ func (e *packCmd) Exec(args []string) error {
return err return err
} }
if err := Package(fp, decls); err != nil { if err := Package(info, fp, decls); err != nil {
return err return err
} }
@ -123,7 +123,7 @@ func (e *packCmd) Flags() *flag.FlagSet {
return e.FlagSet return e.FlagSet
} }
func Package(out string, decls parser.Decls) error { func Package(info here.Info, out string, decls parser.Decls) error {
os.RemoveAll(out) os.RemoveAll(out)
defer func() { defer func() {
if err := recover(); err != nil { if err := recover(); err != nil {
@ -146,7 +146,7 @@ func Package(out string, decls parser.Decls) error {
fmt.Fprintf(f, "import \"github.com/markbates/pkger/pkging/mem\"\n\n") fmt.Fprintf(f, "import \"github.com/markbates/pkger/pkging/mem\"\n\n")
fmt.Fprintf(f, "\nvar _ = pkger.Apply(mem.UnmarshalEmbed([]byte(`") fmt.Fprintf(f, "\nvar _ = pkger.Apply(mem.UnmarshalEmbed([]byte(`")
if err := pkgutil.Stuff(f, c, decls); err != nil { if err := pkgutil.Stuff(f, info, decls); err != nil {
return err return err
} }