mirror of
https://github.com/cubixle/tuugen.git
synced 2026-04-30 16:48:42 +01:00
service and interactor generation
This commit is contained in:
@@ -14,3 +14,26 @@ func runCommand(cmd string, args []string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GenerateProtos() error {
|
||||
cmd := "protoc"
|
||||
args := []string{"-I", ".:${GOPATH}/src", "--go_out=.", "--go-grpc_out=.", "service.proto"}
|
||||
return runCommand(cmd, args)
|
||||
}
|
||||
|
||||
func GoFmt() error {
|
||||
cmd := "gofmt"
|
||||
return runCommand(cmd, []string{})
|
||||
}
|
||||
|
||||
func GoImports() error {
|
||||
if err := runCommand("goimports", []string{"-w", "internal/service/service.go"}); err != nil {
|
||||
return err
|
||||
}
|
||||
return runCommand("goimports", []string{"-w", "internal/interactors/interactors.go"})
|
||||
}
|
||||
|
||||
func GoModInit(importPath string) error {
|
||||
runCommand("go", []string{"mod", "init", importPath})
|
||||
return runCommand("go", []string{"mod", "tidy"})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user