markbates / pkger

Embed static files in Go binaries (replacement for gobuffalo/packr)
MIT License
1.19k stars 60 forks source link

New generated code comment has dangling parameter which causes pkged.go to fail to compile. #71

Closed swedishborgie closed 4 years ago

swedishborgie commented 4 years ago

It looks like #69 introduced a Fprintf with an extraneous parameter which is causing generated code to be invalid:

fmt.Fprintf(f, "// Code generated by pkger; DO NOT EDIT.\n\n", name) // <-- name is extraneous

With Go 1.13 this produces the following code:

// Code generated by pkger; DO NOT EDIT.

%!(EXTRA string=main)package main

import (
    "github.com/markbates/pkger"
    "github.com/markbates/pkger/pkging/mem"
)

var _ = pkger.Apply(mem.UnmarshalEmbed([]byte(<snip>)))
hnnsgstfssn commented 4 years ago

Was noted on review of #69 that it would cause vet errors and then addressed in #70 which was just merged.

swedishborgie commented 4 years ago

Yep, confirmed. PR #70 fixes this issue. Closed PR #72. Thanks!