Merge pull request #14 from liftoffio/internal-package-fix

Fix handling of Go files in internal packages
This commit is contained in:
Victor Starodub
2016-04-10 01:33:20 +04:00
+4 -1
View File
@@ -10,6 +10,7 @@ import (
"io/ioutil"
"os"
"os/exec"
"path/filepath"
)
const genPackage = "github.com/mailru/easyjson/gen"
@@ -72,11 +73,13 @@ func (g *Generator) writeStub() error {
// writeMain creates a .go file that launches the generator if 'go run'.
func (g *Generator) writeMain() (path string, err error) {
f, err := ioutil.TempFile("", "easyjson")
f, err := ioutil.TempFile(filepath.Dir(g.OutName), "easyjson-bootstrap")
if err != nil {
return "", err
}
fmt.Fprintln(f, "// +build ignore")
fmt.Fprintln(f)
fmt.Fprintln(f, "// TEMPORARY AUTOGENERATED FILE: easyjson bootstapping code to launch")
fmt.Fprintln(f, "// the actual generator.")
fmt.Fprintln(f)