Feature rpc protoc (#1251)

* code generation by protoc

* generate pb by protoc direct

* support: grpc code generation by protoc directly

* format code

* check --go_out & --go-grpc_out

* fix typo

* Update version

* fix typo

* optimize: remove deprecated unit test

* format code

Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
anqiansong
2022-01-11 20:34:25 +08:00
committed by GitHub
parent 2203809e5e
commit 9b592b3dee
13 changed files with 495 additions and 79 deletions

View File

@@ -10,7 +10,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/tal-tech/go-zero/tools/goctl/api/parser"
"github.com/tal-tech/go-zero/tools/goctl/rpc/execx"
)
const testApiTemplate = `
@@ -537,10 +536,8 @@ func validate(t *testing.T, api string) {
}
func validateWithCamel(t *testing.T, api, camel string) {
dir := "_go"
os.RemoveAll(dir)
dir := t.TempDir()
err := DoGenProject(api, dir, camel)
defer os.RemoveAll(dir)
assert.Nil(t, err)
filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
if strings.HasSuffix(path, ".go") {
@@ -550,9 +547,6 @@ func validateWithCamel(t *testing.T, api, camel string) {
}
return nil
})
_, err = execx.Run("go test ./...", dir)
assert.Nil(t, err)
}
func validateCode(code string) error {

1
tools/goctl/api/parser/g4/gen/api/apiparser_parser.go Normal file → Executable file
View File

@@ -634,3 +634,4 @@ func NewSyntaxLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, in
return p
}