Yas*_*han 1 go protocol-buffers protobuf-c protobuf-java protobuf-go
在编译原型文件时,我收到““int”未定义”。
“测试.proto”文件
syntax = "proto3";
package test;
option go_package = "/;test";
message User {
string FirstName = 1;
string LastName = 2;
string Address = 3;
int Contact = 4;
int Age = 5;
}
Run Code Online (Sandbox Code Playgroud)
Output:
test.proto:11:5: "int" is not defined.
Run Code Online (Sandbox Code Playgroud)
int不是 proto3 中的标量类型。您必须使用指定的有效标量值类型之一:
https://developers.google.com/protocol-buffers/docs/proto3#scalar
替换int为int32:
syntax = "proto3";
package test;
option go_package = "/;test";
message User {
string FirstName = 1;
string LastName = 2;
string Address = 3;
int32 Contact = 4;
int32 Age = 5;
}
Run Code Online (Sandbox Code Playgroud)