syntax = "proto3";
package protobuf;
message Content
{
int32 id = 1;
string command = 2;
int32 param_id = 3;
string param_string = 4;
}
message BackContent
{
int32 id = 1;
Auth auth = 2;
}
message Auth
{
bool isOk = 1;
Userinfo useInfo = 2;
}
message Userinfo
{
string nick = 1;
int32 uid = 2;
int32 roomId = 3;
string roomName = 4;
}
p1 := &protobuf.BackContent{}
p1.Id = 1
p1.Auth.IsOk = true // 这一行赋值为什么一直报错, 上面一行就可以的,这个给嵌套的赋值咋操作的
1
ffeii 2018-11-02 16:47:54 +08:00 via iPhone
猜测 p1.auth.IsOk = true
|
2
thomaswang OP ```
userinfo := &protobuf.Userinfo{} auth := &protobuf.Auth{} auth.UseInfo = userinfo p1.Auth = auth ``` |