| 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..aa81757ee12016ea28772d89ffaf7fae1482bd73 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,29 @@ 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.")
|
| +
|
| + config := common.GetCliConfigWithFlagSet(os.Args, flagSet)
|
| t := translator.NewTranslator(config.FileGraph())
|
| - goConfig := goConfig{config, t}
|
| + goConfig := goConfig{config, t, noGoSrc}
|
| + t.Config = goConfig
|
| 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) {
|
|
|