revert changes

This commit is contained in:
anqiansong
2021-09-11 20:57:58 +08:00
parent f0ed2370a3
commit ded22e296e
7 changed files with 83 additions and 106 deletions

View File

@@ -1,11 +1,9 @@
package generator
import (
"fmt"
"go/build"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
@@ -15,7 +13,6 @@ import (
"github.com/tal-tech/go-zero/core/stringx"
conf "github.com/tal-tech/go-zero/tools/goctl/config"
"github.com/tal-tech/go-zero/tools/goctl/rpc/execx"
"github.com/tal-tech/go-zero/tools/goctl/util/env"
)
var cfg = &conf.Config{
@@ -25,7 +22,7 @@ var cfg = &conf.Config{
func TestRpcGenerate(t *testing.T) {
_ = Clean()
dispatcher := NewDefaultGenerator()
err := prepare()
err := dispatcher.Prepare()
if err != nil {
logx.Error(err)
return
@@ -92,16 +89,3 @@ func TestRpcGenerate(t *testing.T) {
}
})
}
func prepare() error {
if !env.CanExec() {
return fmt.Errorf("%s: can not start new processes using os.StartProcess or exec.Command", runtime.GOOS)
}
if _, err := env.LookUpGo(); err != nil {
return err
}
if _, err := env.LookUpProtoc(); err != nil {
return err
}
return nil
}