Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: mojom/generators/go/go_generator.go

Issue 2091493002: Switch to the new go generator in the mojo tree. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix more things. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698