mirror of
https://github.com/netbirdio/easyjson.git
synced 2026-05-22 18:44:42 -07:00
Merge pull request #14 from liftoffio/internal-package-fix
Fix handling of Go files in internal packages
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user