mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-04-17 11:42:38 +00:00
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>
This commit is contained in:
parent
6ceeaab1ba
commit
5455ef5ca4
@ -40,6 +40,10 @@ const (
|
||||
// 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 @@ func deprecationComment(deprecated bool) string {
|
||||
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()
|
||||
}
|
||||
|
@ -156,8 +156,6 @@ func (*Any) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_any_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (*Any) XXX_WellKnownType() string { return "Any" }
|
||||
|
||||
func (x *Any) GetTypeUrl() string {
|
||||
if x != nil {
|
||||
return x.TypeUrl
|
||||
|
@ -116,8 +116,6 @@ func (*Duration) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_duration_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (*Duration) XXX_WellKnownType() string { return "Duration" }
|
||||
|
||||
func (x *Duration) GetSeconds() int64 {
|
||||
if x != nil {
|
||||
return x.Seconds
|
||||
|
@ -54,8 +54,6 @@ func (*Empty) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_empty_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (*Empty) XXX_WellKnownType() string { return "Empty" }
|
||||
|
||||
var File_google_protobuf_empty_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_google_protobuf_empty_proto_rawDesc = []byte{
|
||||
|
@ -60,8 +60,6 @@ func (NullValue) EnumDescriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_struct_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (NullValue) XXX_WellKnownType() string { return "NullValue" }
|
||||
|
||||
// `Struct` represents a structured data value, consisting of fields
|
||||
// which map to dynamically typed values. In some languages, `Struct`
|
||||
// might be supported by a native representation. For example, in
|
||||
@ -100,8 +98,6 @@ func (*Struct) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_struct_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (*Struct) XXX_WellKnownType() string { return "Struct" }
|
||||
|
||||
func (x *Struct) GetFields() map[string]*Value {
|
||||
if x != nil {
|
||||
return x.Fields
|
||||
@ -159,8 +155,6 @@ func (*Value) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_struct_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (*Value) XXX_WellKnownType() string { return "Value" }
|
||||
|
||||
func (m *Value) GetKind() isValue_Kind {
|
||||
if m != nil {
|
||||
return m.Kind
|
||||
@ -283,8 +277,6 @@ func (*ListValue) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_struct_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (*ListValue) XXX_WellKnownType() string { return "ListValue" }
|
||||
|
||||
func (x *ListValue) GetValues() []*Value {
|
||||
if x != nil {
|
||||
return x.Values
|
||||
|
@ -136,8 +136,6 @@ func (*Timestamp) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_timestamp_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" }
|
||||
|
||||
func (x *Timestamp) GetSeconds() int64 {
|
||||
if x != nil {
|
||||
return x.Seconds
|
||||
|
@ -50,8 +50,6 @@ func (*DoubleValue) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (*DoubleValue) XXX_WellKnownType() string { return "DoubleValue" }
|
||||
|
||||
func (x *DoubleValue) GetValue() float64 {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
@ -92,8 +90,6 @@ func (*FloatValue) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (*FloatValue) XXX_WellKnownType() string { return "FloatValue" }
|
||||
|
||||
func (x *FloatValue) GetValue() float32 {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
@ -134,8 +130,6 @@ func (*Int64Value) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (*Int64Value) XXX_WellKnownType() string { return "Int64Value" }
|
||||
|
||||
func (x *Int64Value) GetValue() int64 {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
@ -176,8 +170,6 @@ func (*UInt64Value) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (*UInt64Value) XXX_WellKnownType() string { return "UInt64Value" }
|
||||
|
||||
func (x *UInt64Value) GetValue() uint64 {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
@ -218,8 +210,6 @@ func (*Int32Value) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (*Int32Value) XXX_WellKnownType() string { return "Int32Value" }
|
||||
|
||||
func (x *Int32Value) GetValue() int32 {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
@ -260,8 +250,6 @@ func (*UInt32Value) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (*UInt32Value) XXX_WellKnownType() string { return "UInt32Value" }
|
||||
|
||||
func (x *UInt32Value) GetValue() uint32 {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
@ -302,8 +290,6 @@ func (*BoolValue) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (*BoolValue) XXX_WellKnownType() string { return "BoolValue" }
|
||||
|
||||
func (x *BoolValue) GetValue() bool {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
@ -344,8 +330,6 @@ func (*StringValue) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (*StringValue) XXX_WellKnownType() string { return "StringValue" }
|
||||
|
||||
func (x *StringValue) GetValue() string {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
@ -386,8 +370,6 @@ func (*BytesValue) Descriptor() ([]byte, []int) {
|
||||
return file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (*BytesValue) XXX_WellKnownType() string { return "BytesValue" }
|
||||
|
||||
func (x *BytesValue) GetValue() []byte {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
|
Loading…
x
Reference in New Issue
Block a user