From 1080a45db5b5098b9df1b6ed65a54c41ee25fc32 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 19 Jul 2019 01:17:31 -0700 Subject: [PATCH] cmd/protoc-gen-go: remove XXX_WellKnownType Change-Id: I57821f6d9e4950707442b5713734a316727ae96a Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/186897 Reviewed-by: Damien Neil --- cmd/protoc-gen-go/internal_gengo/main.go | 38 ------------------------ 1 file changed, 38 deletions(-) diff --git a/cmd/protoc-gen-go/internal_gengo/main.go b/cmd/protoc-gen-go/internal_gengo/main.go index 1cda52c5..8cc86496 100644 --- a/cmd/protoc-gen-go/internal_gengo/main.go +++ b/cmd/protoc-gen-go/internal_gengo/main.go @@ -48,10 +48,6 @@ const ( // ExtensionRangeArray method for messages that support extensions. generateExtensionRangeMethods = true - // generateWKTMarkerMethods specifies whether to generate - // XXX_WellKnownType methods on well-known types. - generateWKTMarkerMethods = false - // generateMessageStateFields specifies whether to generate an unexported // protoimpl.MessageState as the first field. generateMessageStateFields = true @@ -98,28 +94,6 @@ type goImportPath interface { Ident(string) protogen.GoIdent } -// Names of messages and enums for which we will generate XXX_WellKnownType methods. -var wellKnownTypes = map[protoreflect.FullName]bool{ - "google.protobuf.Any": true, - "google.protobuf.Duration": true, - "google.protobuf.Empty": true, - "google.protobuf.Struct": true, - "google.protobuf.Timestamp": true, - - "google.protobuf.BoolValue": true, - "google.protobuf.BytesValue": true, - "google.protobuf.DoubleValue": true, - "google.protobuf.FloatValue": true, - "google.protobuf.Int32Value": true, - "google.protobuf.Int64Value": true, - "google.protobuf.ListValue": true, - "google.protobuf.NullValue": true, - "google.protobuf.StringValue": true, - "google.protobuf.UInt32Value": true, - "google.protobuf.UInt64Value": true, - "google.protobuf.Value": true, -} - type fileInfo struct { *protogen.File @@ -403,12 +377,6 @@ func genEnum(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, enum g.P("}") g.P() } - - // XXX_WellKnownType method. - if generateWKTMarkerMethods && wellKnownTypes[enum.Desc.FullName()] { - g.P("func (", enum.GoIdent, `) XXX_WellKnownType() string { return "`, enum.Desc.Name(), `" }`) - g.P() - } } // enumLegacyName returns the name used by the v1 proto package. @@ -666,12 +634,6 @@ func genMessageBaseMethods(gen *protogen.Plugin, g *protogen.GeneratedFile, f *f g.P("}") g.P() } - - // XXX_WellKnownType method. - if generateWKTMarkerMethods && wellKnownTypes[message.Desc.FullName()] { - g.P("func (*", message.GoIdent, `) XXX_WellKnownType() string { return "`, message.Desc.Name(), `" }`) - g.P() - } } func genMessageGetterMethods(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, message *protogen.Message) {