cmd/protoc-gen-go: remove json ignore tags

These are not necessary now that weak fields are unexported.

Change-Id: Ida18b984abedfdf52fd3d5f3cb2f4ca580659a5c
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/210745
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
Joe Tsai 2019-12-10 13:06:21 -08:00 committed by Joe Tsai
parent 4151cae27a
commit 8517608739
3 changed files with 4 additions and 7 deletions

View File

@ -404,7 +404,7 @@ func genMessageInternalFields(g *protogen.GeneratedFile, f *fileInfo, m *message
g.P(genname.SizeCache, " ", protoimplPackage.Ident("SizeCache"))
sf.append(genname.SizeCache)
if m.HasWeak {
g.P(genname.WeakFields, " ", protoimplPackage.Ident("WeakFields"), jsonIgnoreTags)
g.P(genname.WeakFields, " ", protoimplPackage.Ident("WeakFields"))
sf.append(genname.WeakFields)
}
g.P(genname.UnknownFields, " ", protoimplPackage.Ident("UnknownFields"))
@ -900,10 +900,7 @@ func genNoInterfacePragma(g *protogen.GeneratedFile, tracked bool) {
}
}
var (
gotrackTags = structTags{{"go", "track"}}
jsonIgnoreTags = structTags{{"json", "-"}}
)
var gotrackTags = structTags{{"go", "track"}}
// structTags is a data structure for build idiomatic Go struct tags.
// Each [2]string is a key-value pair, where value is the unescaped string.

View File

@ -20,7 +20,7 @@ import (
type TestFieldTrack struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
weakFields protoimpl.WeakFields `json:"-"`
weakFields protoimpl.WeakFields
unknownFields protoimpl.UnknownFields
OptionalInt32 *int32 `protobuf:"varint,1,opt,name=optional_int32,json=optionalInt32" json:"optional_int32,omitempty" go:"track"`

View File

@ -1648,7 +1648,7 @@ func (x *TestRequiredGroupFields) GetRepeatedgroup() []*TestRequiredGroupFields_
type TestWeak struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
weakFields protoimpl.WeakFields `json:"-"`
weakFields protoimpl.WeakFields
unknownFields protoimpl.UnknownFields
XXX_weak_WeakMessage1 struct{} `protobuf:"bytes,1,opt,name=weak_message1,json=weakMessage1,weak=goproto.proto.test.weak.WeakImportMessage1" json:"weak_message1,omitempty"`