diff --git a/cmd/protoc-gen-go/internal_gengo/main.go b/cmd/protoc-gen-go/internal_gengo/main.go index e8b22074..f7388224 100644 --- a/cmd/protoc-gen-go/internal_gengo/main.go +++ b/cmd/protoc-gen-go/internal_gengo/main.go @@ -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. diff --git a/internal/testprotos/fieldtrack/fieldtrack.pb.go b/internal/testprotos/fieldtrack/fieldtrack.pb.go index 63e0c1c4..fbecaea9 100644 --- a/internal/testprotos/fieldtrack/fieldtrack.pb.go +++ b/internal/testprotos/fieldtrack/fieldtrack.pb.go @@ -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"` diff --git a/internal/testprotos/test/test.pb.go b/internal/testprotos/test/test.pb.go index 59a68492..4b200fcd 100644 --- a/internal/testprotos/test/test.pb.go +++ b/internal/testprotos/test/test.pb.go @@ -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"`