我有两个协议缓冲区,X和Y定义如下:
message X {
string value1 = 1;
enum Status {
STATUS_UNSPECIFIED = 0;
ACTIVE = 1;
DELETED = 2;
}
Status status = 2;
}
message Y {
string value2 = 1;
enum Status {
STATUS_UNSPECIFIED = 0;
ACTIVE = 1;
DELETED = 2;
}
Status status = 2;
}
我有一个X
的实例,比如x
。如何在Go中轻松地将x.status
分配给y.status
类型的新Y
?