diff --git a/bootstrap/bootstrap.go b/bootstrap/bootstrap.go index 0d548d5..3b04fb1 100644 --- a/bootstrap/bootstrap.go +++ b/bootstrap/bootstrap.go @@ -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)