Chromium Code Reviews| Index: mojom/generators/go/go_generator.go |
| diff --git a/mojom/generators/go/go_generator.go b/mojom/generators/go/go_generator.go |
| index 90fc2293f2bb482e9af98da189412c3d097c084c..150e372781b127f2bbe773b372ccd6b1351c91d1 100644 |
| --- a/mojom/generators/go/go_generator.go |
| +++ b/mojom/generators/go/go_generator.go |
| @@ -5,6 +5,7 @@ |
| package main |
| import ( |
| + "flag" |
| "log" |
| "os" |
| "path/filepath" |
| @@ -16,19 +17,28 @@ import ( |
| func main() { |
| log.SetFlags(0) |
| - config := common.GetCliConfig(os.Args) |
| + flagSet := flag.NewFlagSet("Generator Go Flag Set", flag.ExitOnError) |
| + var noGoSrc bool |
| + flagSet.BoolVar(&noGoSrc, "no-go-src", false, "Do not prepend the output path with go/src.") |
|
vardhan
2016/06/24 01:36:07
the solution i had in mind for this was to have a
vardhan
2016/06/24 01:42:19
wait, i misunderstood this flag for something else
azani
2016/06/24 19:21:21
Yes, because the output dir is the same for all th
|
| + |
| + config := common.GetCustomCliConfig(os.Args, flagSet) |
| t := translator.NewTranslator(config.FileGraph()) |
| - goConfig := goConfig{config, t} |
| + goConfig := goConfig{config, t, noGoSrc} |
| common.GenerateOutput(WriteGoFile, goConfig) |
| } |
| type goConfig struct { |
| common.GeneratorConfig |
| translator translator.Translator |
| + noGoSrc bool |
| } |
| func (c goConfig) OutputDir() string { |
| - return filepath.Join(c.GeneratorConfig.OutputDir(), "go", "src") |
| + if c.noGoSrc { |
| + return c.GeneratorConfig.OutputDir() |
| + } else { |
| + return filepath.Join(c.GeneratorConfig.OutputDir(), "go", "src") |
| + } |
| } |
| func WriteGoFile(fileName string, config common.GeneratorConfig) { |