首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误:后处理失败: 820:39:缺少“,”在参数列表中

错误:后处理失败: 820:39:缺少“,”在参数列表中
EN

Stack Overflow用户
提问于 2021-12-15 07:48:49
回答 1查看 1.9K关注 0票数 3

protoc-gen-validate是一个原型插件,用于生成polyglot消息验证器。

该项目使用Bazel进行构建,并有一个开拉请求来添加对验证错误消息的自定义支持。

最初的代码是在2020年制定的。最近,它用最新的代码进行了更新,在修复了所有合并冲突之后,现在它无法构建,但是我找不到问题:

代码语言:javascript
复制
~/GitHub/protoc-gen-validate (i18n) $ make bazel-tests
bazel test //tests/... --test_output=errors
INFO: Analyzed 68 targets (0 packages loaded, 0 targets configured).
INFO: Found 62 targets and 6 test targets...
ERROR: /Users/mparnisari/GitHub/protoc-gen-validate/tests/harness/cases/BUILD:46:21: Generating into bazel-out/darwin-fastbuild/bin/tests/harness/cases/go_/github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/go failed: (Exit 1): go-protoc-bin failed: error executing command bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_go/go/tools/builders/go-protoc-bin_/go-protoc-bin -protoc bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/protoc ... (remaining 117 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
[error] failed post-processing: 820:39: missing ',' in argument list (and 10 more errors)
--validate_out: protoc-gen-validate: Plugin failed with status code 1.
2021/12/14 23:46:43 error running protoc: exit status 1
ERROR: /Users/mparnisari/GitHub/protoc-gen-validate/tests/harness/cases/BUILD:46:21 GoCompilePkg tests/harness/cases/go.a failed: (Exit 1): go-protoc-bin failed: error executing command bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_go/go/tools/builders/go-protoc-bin_/go-protoc-bin -protoc bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/protoc ... (remaining 117 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
INFO: Elapsed time: 0.962s, Critical Path: 0.48s
INFO: 8 processes: 8 internal.
FAILED: Build did NOT complete successfully

从启动test命令后立即出现错误([error] failed post-processing: 820:39: missing ',' in argument list (and 10 more errors))这一事实判断,我认为这是Bazel的一个问题,但我不确定。

更新1:我把范围缩小到以下几个方面:

代码语言:javascript
复制
~/GitHub/fork/protoc-gen-validate (i18n) $ make testcases
cd tests/harness/cases && \
        protoc \
                -I . \
                -I ../../.. \
                --go_out="module=github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/go,Mtests/harness/cases/other_package/embed.proto=github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/other_package/go;other_package,Mtests/harness/cases/yet_another_package/embed.proto=github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/yet_another_package/go,Mvalidate/validate.proto=github.com/envoyproxy/protoc-gen-validate/validate,Mgoogle/protobuf/any.proto=google.golang.org/protobuf/types/known/anypb,Mgoogle/protobuf/duration.proto=google.golang.org/protobuf/types/known/durationpb,Mgoogle/protobuf/struct.proto=google.golang.org/protobuf/types/known/structpb,Mgoogle/protobuf/timestamp.proto=google.golang.org/protobuf/types/known/timestamppb,Mgoogle/protobuf/wrappers.proto=google.golang.org/protobuf/types/known/wrapperspb,Mgoogle/protobuf/descriptor.proto=google.golang.org/protobuf/types/descriptorpb:./go" \
                --plugin=protoc-gen-go=/Users/mparnisari/go/bin/protoc-gen-go \
                --validate_out="module=github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/go,lang=go,Mtests/harness/cases/other_package/embed.proto=github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/other_package/go,Mtests/harness/cases/yet_another_package/embed.proto=github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/yet_another_package/go:./go" \
                ./*.proto
filename-with-dash.proto:5:1: warning: Import validate/validate.proto is unused.
[error] failed post-processing: 820:39: missing ',' in argument list (and 10 more errors)
--validate_out: protoc-gen-validate: Plugin failed with status code 1.
make: 
*** [testcases] Error 1

更新2:缩小范围。如果我删除这个文件:tests/harness/cases/maps.proto

make testcases工程

更新3:缩小范围。如果我删除这些行:https://github.com/envoyproxy/protoc-gen-validate/blob/main/tests/harness/cases/maps.proto#L14-L17

make testcase工程

EN

回答 1

Stack Overflow用户

发布于 2021-12-17 08:30:48

使用开关--sandbox_debug构建将提供一个未截断的堆栈跟踪。

这都是关于缺少一个逗号的...the,唯一的问题是在哪个文件和行中。

它抱怨harness_py_proto test@ 46:21tests/harness/executor/cases.go建议对文件执行语法检查,因为如果820:39不在某个生成的文件中,这可能是最适合的文件(按行号和错误消息)。我的Go语法并不那么流利,这就是为什么我看不见它的原因--但是语法检查器或linter可以:

代码语言:javascript
复制
lint bazel testcases bazel-tests

此外,Makefile可能是一个可能的候选人,但并没有发生什么事情:

代码语言:javascript
复制
.PHONY: harness
harness: testcases tests/harness/go/harness.pb.go tests/harness/go/main/go-harness tests/harness/cc/cc-harness bin/harness ## runs the test harness, validating a series of test cases in all supported languages
    ./bin/harness -go -cc

.PHONY: bazel-tests
bazel-tests: ## runs all tests with Bazel
    bazel test //tests/... --test_output=errors

以前试过运行make harness吗?当它照评论说的做的时候..。

代码语言:javascript
复制
## runs the test harness, validating a series of test cases in all supported languages
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70360041

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档