1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package got
- import (
- "fmt"
- "os"
- . "git.eugeniocarvalho.dev/eugeniucarvalho/apicodegen/common"
- )
- var Build = func(project *Project, buildOptions *BuildOptions) (fn *BuildSet, err error) {
- var (
- files []os.FileInfo
- before = []*Command{
- {
- Cmd: "rm -f go.*",
- Description: "Remove os arquivos do módulo do GO",
- },
- {
- Cmd: "go mod init {project.custom.go.package.repository}/build",
- Description: "Inicializa o módulo do GO",
- },
- }
- )
- if files, err = GetFiles(project.Paths.Include("/go")); err == nil {
- for _, file := range files {
- if file.Name()[0] == '*' {
- continue
- }
- if file.IsDir() {
- name := file.Name()
- before = append(before, &Command{
- Cmd: fmt.Sprintf("go mod edit -replace {project.custom.go.package.repository}/build/v1/%s=./v1/%s", name, name),
- Description: "Inicializa o módulo do GO",
- })
- }
- }
- }
- fn = &BuildSet{
- Before: before,
- After: []*Command{
- {
- Id: "build",
- Cmd: "GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ../dist/server",
- Description: "Compila a aplicação server da api",
- },
- // {
- // Id: "clear",
- // Cmd: "",
- // Description: "Clear temporary files",
- // },
- },
- }
- return
- }
|