gpt4 book ai didi

go - Proto3 for Go 的可选支持

转载 作者:行者123 更新时间:2023-12-05 02:38:23 25 4
gpt4 key购买 nike

使用 Go 时 proto3 是否支持可选?我试过这个:

protoc person.proto --go_out=. --experimental_allow_proto3_optional

但是出现了这个错误

person.proto: is a proto3 file that contains optional fields, but code generator protoc-gen-go hasn't been updated to support optionalfields in proto3. Please ask the owner of this code generator tosupport proto3 optional.--go_out:

所以 proto3 (Go) 不支持 optional 关键字?

最佳答案

protoc 确实支持它,从版本 v3.15.0 开始。查看release notes :

Optional fields for proto3 are enabled by default, and no longer requirethe --experimental_allow_proto3_optional flag.

protoc-gen-go 插件从 v1.22.0 开始。 Release notes :

This release adds support for the experimental proto3 optional semantics coming in the v3.12.0 release of the protobuf language, [...]

确保将您的 protoc-gen-go 升级到 v1.22.0 或更高版本。

关于go - Proto3 for Go 的可选支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69631001/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com