diff --git a/internal/encoding/tag/tag.go b/internal/encoding/tag/tag.go index 80e8488b..948ca8b2 100644 --- a/internal/encoding/tag/tag.go +++ b/internal/encoding/tag/tag.go @@ -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 diff --git a/internal/testprotos/test/test.pb.go b/internal/testprotos/test/test.pb.go index bae3e177..f8c7e8cd 100644 --- a/internal/testprotos/test/test.pb.go +++ b/internal/testprotos/test/test.pb.go @@ -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 }