mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2024-12-28 18:25:46 +00:00
internal/encoding/tag: support marshaling weak fields
We already support unmarshaling weak fields, support the other direction. Change-Id: I514e6b7b18cf9a3567fb1775a1e389fe64f22d22 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/185340 Reviewed-by: Herbie Ong <herbie@google.com>
This commit is contained in:
parent
e5900a6a90
commit
ace50e2b5e
@ -170,7 +170,9 @@ func Marshal(fd pref.FieldDescriptor, enumName string) string {
|
||||
if fd.IsPacked() {
|
||||
tag = append(tag, "packed")
|
||||
}
|
||||
// TODO: Weak fields?
|
||||
if fd.IsWeak() {
|
||||
tag = append(tag, "weak="+string(fd.Message().FullName()))
|
||||
}
|
||||
name := string(fd.Name())
|
||||
if fd.Kind() == pref.GroupKind {
|
||||
// The name of the FieldDescriptor for a group field is
|
||||
|
@ -1469,7 +1469,7 @@ func (x *TestRequiredGroupFields) GetRepeatedgroup() []*TestRequiredGroupFields_
|
||||
}
|
||||
|
||||
type TestWeak struct {
|
||||
WeakMessage *weak.WeakImportMessage `protobuf:"bytes,1,opt,name=weak_message,json=weakMessage" json:"weak_message,omitempty"`
|
||||
WeakMessage *weak.WeakImportMessage `protobuf:"bytes,1,opt,weak=goproto.proto.test.weak.WeakImportMessage,name=weak_message,json=weakMessage" json:"weak_message,omitempty"`
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user