cmd/protoc-gen-go: remove XXX_WellKnownType

Change-Id: I57821f6d9e4950707442b5713734a316727ae96a
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/186897
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/cmd/protoc-gen-go/internal_gengo/main.go b/cmd/protoc-gen-go/internal_gengo/main.go
index 1cda52c..8cc8649 100644
--- a/cmd/protoc-gen-go/internal_gengo/main.go
+++ b/cmd/protoc-gen-go/internal_gengo/main.go
@@ -48,10 +48,6 @@
 	// 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 @@
 	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 @@
 		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 @@
 		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) {