cmd/protoc-gen-go: disable generation of XXX_WellKnownType

The logic for this will be removed entirely in a future CL.

Change-Id: I3a20fb2a207fc5bedc550b3f6deeab7f63eaa2c4
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/185243
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/cmd/protoc-gen-go/internal_gengo/main.go b/cmd/protoc-gen-go/internal_gengo/main.go
index 7a2fee0..47c47aa 100644
--- a/cmd/protoc-gen-go/internal_gengo/main.go
+++ b/cmd/protoc-gen-go/internal_gengo/main.go
@@ -40,6 +40,10 @@
 	// XXX_OneofWrappers methods on messages with oneofs.
 	generateOneofWrapperMethods = false
 
+	// generateWKTMarkerMethods specifes whether to generate
+	// XXX_WellKnownType methods on well-known types.
+	generateWKTMarkerMethods = false
+
 	// generateNoUnkeyedLiteralFields specifies whether to generate
 	// the XXX_NoUnkeyedLiteral field.
 	generateNoUnkeyedLiteralFields = false
@@ -742,10 +746,8 @@
 	return "// Deprecated: Do not use."
 }
 
-// TODO: Remove this. This was added to aid protojson, but protojson does this work
-// through the use of protobuf reflection now.
 func genWellKnownType(g *protogen.GeneratedFile, ptr string, ident protogen.GoIdent, desc protoreflect.Descriptor) {
-	if wellKnownTypes[desc.FullName()] {
+	if generateWKTMarkerMethods && wellKnownTypes[desc.FullName()] {
 		g.P("func (", ptr, ident, `) XXX_WellKnownType() string { return "`, desc.Name(), `" }`)
 		g.P()
 	}