package commands import ( "fmt" . "git.eugeniocarvalho.dev/eugeniucarvalho/apicodegen/common" . "git.eugeniocarvalho.dev/eugeniucarvalho/apicodegen/gen" "git.eugeniocarvalho.dev/eugeniucarvalho/apicodegen/flag" "github.com/davecgh/go-spew/spew" ) func compile() (err error) { var project *Project fmt.Println("COMPILE WITH SETUP...", *flag.Mode, *flag.BuildProfile, *flag.Out) // Cria um novo projeto a partir do diretorio atual if project, err = CreateProject(*flag.Mode); err != nil { panic(err) } project.OutDirectory(*flag.Out) // Executa a geracao de codigo para o projeto if err = project.Build(&BuildOptions{ Mode: *flag.BuildProfile, }); err != nil { spew.Dump(err) panic(err) } // Salva o json contendo a descricao completa do projeto if err = project.Save(fmt.Sprintf("%s/project.gen.json", *flag.Out)); err != nil { panic(err) } return }