Add --go_opt flag to adapt to the version after 1.4.0 of protoc-gen-go (#767)

Co-authored-by: anqiansong <anqiansong@xiaoheiban.cn>
This commit is contained in:
anqiansong
2021-07-08 10:11:11 +08:00
committed by GitHub
parent 22a1315136
commit efdf475da4
8 changed files with 89 additions and 16 deletions

View File

@@ -41,7 +41,11 @@ func TestRpcGenerate(t *testing.T) {
defer func() {
_ = os.RemoveAll(srcDir)
}()
err = g.Generate("./test.proto", projectDir, []string{src})
common, err := filepath.Abs(".")
assert.Nil(t, err)
err = g.Generate("./test.proto", projectDir, []string{common, src}, "Mbase/common.proto=./base")
assert.Nil(t, err)
_, err = execx.Run("go test "+projectName, projectDir)
if err != nil {
@@ -60,7 +64,7 @@ func TestRpcGenerate(t *testing.T) {
}
projectDir = filepath.Join(workDir, projectName)
err = g.Generate("./test.proto", projectDir, []string{src})
err = g.Generate("./test.proto", projectDir, []string{common, src}, "Mbase/common.proto=./base")
assert.Nil(t, err)
_, err = execx.Run("go test "+projectName, projectDir)
if err != nil {
@@ -70,7 +74,7 @@ func TestRpcGenerate(t *testing.T) {
}
// case not in go mod and go path
err = g.Generate("./test.proto", projectDir, []string{src})
err = g.Generate("./test.proto", projectDir, []string{common, src}, "Mbase/common.proto=./base")
assert.Nil(t, err)
_, err = execx.Run("go test "+projectName, projectDir)
if err != nil {