Added the ability to pass arguments to the go tool from the Windows constant generator's command line; this will be for debugging.
This commit is contained in:
parent
9893387848
commit
a0f10000de
|
@ -78,11 +78,12 @@ func preamble(pkg string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if len(os.Args) != 3 {
|
if len(os.Args) < 3 {
|
||||||
panic("usage: " + os.Args[0] + " path goarch")
|
panic("usage: " + os.Args[0] + " path goarch [go-command-options...]")
|
||||||
}
|
}
|
||||||
pkgpath := os.Args[1]
|
pkgpath := os.Args[1]
|
||||||
targetarch := os.Args[2]
|
targetarch := os.Args[2]
|
||||||
|
goopts := os.Args[3:] // valid if len(os.Args) == 3; in that case this will just be a slice of length zero
|
||||||
|
|
||||||
pkg := getPackage(pkgpath)
|
pkg := getPackage(pkgpath)
|
||||||
gatherNames(pkg)
|
gatherNames(pkg)
|
||||||
|
@ -131,7 +132,9 @@ func main() {
|
||||||
fmt.Fprintf(f, "}\n")
|
fmt.Fprintf(f, "}\n")
|
||||||
f.Close()
|
f.Close()
|
||||||
|
|
||||||
cmd := exec.Command("go", "run", genoutname)
|
cmd := exec.Command("go", "run")
|
||||||
|
cmd.Args = append(cmd.Args, goopts...)
|
||||||
|
cmd.Args = append(cmd.Args, genoutname)
|
||||||
f, err = os.Create(filepath.Join(pkgpath, "zconstants_windows_" + targetarch + ".go"))
|
f, err = os.Create(filepath.Join(pkgpath, "zconstants_windows_" + targetarch + ".go"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
Loading…
Reference in New Issue