service and interactor generation

This commit is contained in:
cubixle
2021-06-16 18:39:06 +01:00
parent 84e3cd603e
commit 8f67f0703e
17 changed files with 279 additions and 39 deletions
+23
View File
@@ -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"})
}