-
-
Save bketelsen/087ba36984d172b9b9c5 to your computer and use it in GitHub Desktop.
Under my package's `gen` folder
This file contains hidden or 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" | |
"os" | |
"strings" | |
"github.com/goadesign/goa/dslengine" | |
"github.com/goadesign/goa/goagen/codegen" | |
"github.com/goadesign/goa/goagen/gen_app" | |
_ "github.com/abourget/featurette/design" | |
) | |
func main() { | |
// if possible, shrink that to a single call, too.. | |
failOnError(dslengine.Errors) | |
failOnError(dslengine.Run()) | |
// Now take the results and call the generator with it | |
// FIXME: reduce that to a single line | |
roots := make([]interface{}, len(dslengine.Roots)) | |
for i, r := range dslengine.Roots { | |
roots[i] = r | |
} | |
codegen.OutputDir = "../test" | |
codegen.DesignPackagePath = "github.com/abourget/featurette/design" | |
// shrink these 3 lines to a single line too.. | |
files, err := genapp.Generate(roots) | |
failOnError(err) | |
fmt.Println(strings.Join(files, "\n")) | |
failOrPrint(genswagger.Generate(roots)) | |
failOrPrint(genmyown.Generate(roots)) | |
} | |
// FIXME: move to `codegen` or something.. | |
func failOnError(err error) { | |
if err != nil { | |
fmt.Fprintf(os.Stderr, "%s", err) | |
os.Exit(1) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment