From a0f10000de25f94a84030e388248a6081faa25c0 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 25 May 2014 13:18:45 -0400 Subject: [PATCH] Added the ability to pass arguments to the go tool from the Windows constant generator's command line; this will be for debugging. --- experiments/windowsconstgen.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/experiments/windowsconstgen.go b/experiments/windowsconstgen.go index 6f76eb7..12f2744 100644 --- a/experiments/windowsconstgen.go +++ b/experiments/windowsconstgen.go @@ -78,11 +78,12 @@ func preamble(pkg string) string { } func main() { - if len(os.Args) != 3 { - panic("usage: " + os.Args[0] + " path goarch") + if len(os.Args) < 3 { + panic("usage: " + os.Args[0] + " path goarch [go-command-options...]") } pkgpath := os.Args[1] 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) gatherNames(pkg) @@ -131,7 +132,9 @@ func main() { fmt.Fprintf(f, "}\n") 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")) if err != nil { panic(err)