Last active
March 5, 2016 03:33
-
-
Save abourget/06c803e1e9e102f7dec4 to your computer and use it in GitHub Desktop.
In my package's `gen/` folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strings" | |
_ "github.com/abourget/featurette/design" | |
"github.com/goadesign/goa/design" | |
"github.com/goadesign/goa/dslengine" | |
"github.com/goadesign/goa/goagen/gen_app" | |
"github.com/goadesign/goa/goagen/gen_swagger" | |
) | |
// Call with: "go run gen/main.go" from project root | |
func main() { | |
dslengine.FailOnError(dslengine.Errors) | |
dslengine.FailOnError(dslengine.Run()) | |
apidesign := dslengine.Roots[0].(*design.APIDefinition) | |
genapp.TargetPackage = "app" | |
failOrPrint(new(genapp.Generator).Generate(apidesign)) | |
failOrPrint(new(genswagger.Generator).Generate(apidesign)) | |
// run custom generators... | |
} | |
func failOrPrint(files []string, err error) { | |
dslengine.FailOnError(err) | |
fmt.Println(strings.Join(files, "\n")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternatively, the "make([]interface{}..." could be done by the Generator, if it so requires.. if the interface of dslengine should always be a
[]interface{}
.. then I'd have a func in thedslengine
to do that.. instead of here.