diff --git a/Makefile b/Makefile index df373975..de09cd2d 100644 --- a/Makefile +++ b/Makefile @@ -55,8 +55,8 @@ docker_release: output/pganalyze_collector/snapshot.pb.go: $(PROTOBUF_FILES) ifdef PROTOC_VERSION mkdir -p $(PWD)/bin - GOBIN=$(PWD)/bin go install github.com/golang/protobuf/protoc-gen-go - protoc --go_out=Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp:output/pganalyze_collector -I protobuf $(PROTOBUF_FILES) + GOBIN=$(PWD)/bin go install google.golang.org/protobuf/cmd/protoc-gen-go@latest + protoc --go_out=. --go_opt=module=github.com/pganalyze/collector -I protobuf $(PROTOBUF_FILES) else @echo '👷 Warning: protoc not found, skipping protocol buffer regeneration (to install protoc check Makefile instructions in install_protoc step)' endif diff --git a/go.mod b/go.mod index 8787eef3..7e97505b 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/go-ini/ini v1.62.0 github.com/go-ole/go-ole v0.0.0-20160708033836-be49f7c07711 // indirect github.com/golang-jwt/jwt/v4 v4.1.0 // indirect - github.com/golang/protobuf v1.4.2 + github.com/golang/protobuf v1.4.2 // indirect github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect github.com/gorhill/cronexpr v0.0.0-20160318121724-f0984319b442 github.com/guregu/null v0.0.0-20160228005316-41961cea0328 diff --git a/output/compact.go b/output/compact.go index e53ce9d9..1446a45f 100644 --- a/output/compact.go +++ b/output/compact.go @@ -11,13 +11,13 @@ import ( "strings" "time" - "github.com/golang/protobuf/jsonpb" - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes" "github.com/pganalyze/collector/output/pganalyze_collector" "github.com/pganalyze/collector/state" "github.com/pganalyze/collector/util" uuid "github.com/satori/go.uuid" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/timestamppb" ) func uploadAndSubmitCompactSnapshot(s pganalyze_collector.CompactSnapshot, grant state.Grant, server *state.Server, collectionOpts state.CollectionOpts, logger *util.Logger, collectedAt time.Time, quiet bool, kind string) error { @@ -30,7 +30,7 @@ func uploadAndSubmitCompactSnapshot(s pganalyze_collector.CompactSnapshot, grant s.SnapshotVersionMinor = 0 s.CollectorVersion = util.CollectorNameAndVersion s.SnapshotUuid = snapshotUUID.String() - s.CollectedAt, _ = ptypes.TimestampProto(collectedAt) + s.CollectedAt = timestamppb.New(collectedAt) data, err = proto.Marshal(&s) if err != nil { @@ -81,13 +81,12 @@ func debugCompactOutputAsJSON(logger *util.Logger, compressedData bytes.Buffer) } var out bytes.Buffer - var marshaler jsonpb.Marshaler - dataJSON, err := marshaler.MarshalToString(s) + dataJSON, err := protojson.Marshal(s) if err != nil { logger.PrintError("Failed to transform protocol buffers to JSON: %s", err) return } - json.Indent(&out, []byte(dataJSON), "", "\t") + json.Indent(&out, dataJSON, "", "\t") logger.PrintInfo("Dry run - data that would have been sent will be output on stdout:\n") fmt.Printf("%s\n", out.String()) } diff --git a/output/full.go b/output/full.go index b58cb741..5b37077e 100644 --- a/output/full.go +++ b/output/full.go @@ -11,15 +11,15 @@ import ( "strings" "time" - "github.com/golang/protobuf/jsonpb" - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes" "github.com/pganalyze/collector/output/pganalyze_collector" snapshot "github.com/pganalyze/collector/output/pganalyze_collector" "github.com/pganalyze/collector/output/transform" "github.com/pganalyze/collector/state" "github.com/pganalyze/collector/util" uuid "github.com/satori/go.uuid" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/timestamppb" ) func SendFull(server *state.Server, collectionOpts state.CollectionOpts, logger *util.Logger, newState state.PersistedState, diffState state.DiffState, transientState state.TransientState, collectedIntervalSecs uint32) error { @@ -45,7 +45,7 @@ func submitFull(s snapshot.FullSnapshot, server *state.Server, collectionOpts st s.SnapshotVersionMinor = 0 s.CollectorVersion = util.CollectorNameAndVersion s.SnapshotUuid = snapshotUUID.String() - s.CollectedAt, _ = ptypes.TimestampProto(collectedAt) + s.CollectedAt = timestamppb.New(collectedAt) s.CollectorLogSnapshotDisabled = server.CollectionStatus.LogSnapshotDisabled s.CollectorLogSnapshotDisabledReason = server.CollectionStatus.LogSnapshotDisabledReason @@ -98,13 +98,12 @@ func debugOutputAsJSON(logger *util.Logger, compressedData bytes.Buffer) { } var out bytes.Buffer - var marshaler jsonpb.Marshaler - dataJSON, err := marshaler.MarshalToString(s) + dataJSON, err := protojson.Marshal(s) if err != nil { logger.PrintError("Failed to transform protocol buffers to JSON: %s", err) return } - json.Indent(&out, []byte(dataJSON), "", "\t") + json.Indent(&out, dataJSON, "", "\t") logger.PrintInfo("Dry run - data that would have been sent will be output on stdout:\n") fmt.Printf("%s\n", out.String()) } diff --git a/output/pganalyze_collector/bloat_report.pb.go b/output/pganalyze_collector/bloat_report.pb.go index d56af468..e5981a1a 100644 --- a/output/pganalyze_collector/bloat_report.pb.go +++ b/output/pganalyze_collector/bloat_report.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.14.0 // source: bloat_report.proto package pganalyze_collector import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type BloatLookupMethod int32 const ( @@ -456,7 +451,11 @@ var file_bloat_report_proto_rawDesc = []byte{ 0x12, 0x11, 0x0a, 0x0d, 0x45, 0x53, 0x54, 0x49, 0x4d, 0x41, 0x54, 0x45, 0x5f, 0x46, 0x41, 0x53, 0x54, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x45, 0x53, 0x54, 0x49, 0x4d, 0x41, 0x54, 0x45, 0x5f, 0x53, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x46, 0x55, 0x4c, 0x4c, 0x5f, 0x53, - 0x43, 0x41, 0x4e, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x43, 0x41, 0x4e, 0x10, 0x02, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x2f, 0x63, 0x6f, + 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2f, 0x70, + 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/output/pganalyze_collector/buffercache_report.pb.go b/output/pganalyze_collector/buffercache_report.pb.go index 43bd396c..0e2b79e2 100644 --- a/output/pganalyze_collector/buffercache_report.pb.go +++ b/output/pganalyze_collector/buffercache_report.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.14.0 // source: buffercache_report.proto package pganalyze_collector import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type BuffercacheReportData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -218,8 +213,12 @@ var file_buffercache_report_proto_rawDesc = []byte{ 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x61, - 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x74, 0x6f, 0x61, 0x73, 0x74, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x74, 0x6f, 0x61, 0x73, 0x74, 0x42, + 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x67, + 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x2f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2f, 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, + 0x7a, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/output/pganalyze_collector/compact_activity_snapshot.pb.go b/output/pganalyze_collector/compact_activity_snapshot.pb.go index add7973e..b4049c36 100644 --- a/output/pganalyze_collector/compact_activity_snapshot.pb.go +++ b/output/pganalyze_collector/compact_activity_snapshot.pb.go @@ -1,16 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.14.0 // source: compact_activity_snapshot.proto package pganalyze_collector import ( - proto "github.com/golang/protobuf/proto" - timestamp "github.com/golang/protobuf/ptypes/timestamp" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // ! When changing this, also update mappings/wait_event_type.json type Backend_WaitEventType int32 @@ -932,7 +927,7 @@ type CompactActivitySnapshot struct { Backends []*Backend `protobuf:"bytes,2,rep,name=backends,proto3" json:"backends,omitempty"` // Timestamp of the previous activity snapshot (collected_at) to support the // receiver marking values as having been last visible with the prior snapshot - PrevActivitySnapshotAt *timestamp.Timestamp `protobuf:"bytes,3,opt,name=prev_activity_snapshot_at,json=prevActivitySnapshotAt,proto3" json:"prev_activity_snapshot_at,omitempty"` + PrevActivitySnapshotAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=prev_activity_snapshot_at,json=prevActivitySnapshotAt,proto3" json:"prev_activity_snapshot_at,omitempty"` VacuumProgressInformations []*VacuumProgressInformation `protobuf:"bytes,10,rep,name=vacuum_progress_informations,json=vacuumProgressInformations,proto3" json:"vacuum_progress_informations,omitempty"` VacuumProgressStatistics []*VacuumProgressStatistic `protobuf:"bytes,11,rep,name=vacuum_progress_statistics,json=vacuumProgressStatistics,proto3" json:"vacuum_progress_statistics,omitempty"` } @@ -983,7 +978,7 @@ func (x *CompactActivitySnapshot) GetBackends() []*Backend { return nil } -func (x *CompactActivitySnapshot) GetPrevActivitySnapshotAt() *timestamp.Timestamp { +func (x *CompactActivitySnapshot) GetPrevActivitySnapshotAt() *timestamppb.Timestamp { if x != nil { return x.PrevActivitySnapshotAt } @@ -1009,28 +1004,28 @@ type Backend struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Identity uint64 `protobuf:"varint,1,opt,name=identity,proto3" json:"identity,omitempty"` // Server-wide unique identifier (backend_start + PID) - Pid int32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` - HasRoleIdx bool `protobuf:"varint,3,opt,name=has_role_idx,json=hasRoleIdx,proto3" json:"has_role_idx,omitempty"` - RoleIdx int32 `protobuf:"varint,4,opt,name=role_idx,json=roleIdx,proto3" json:"role_idx,omitempty"` - HasDatabaseIdx bool `protobuf:"varint,5,opt,name=has_database_idx,json=hasDatabaseIdx,proto3" json:"has_database_idx,omitempty"` - DatabaseIdx int32 `protobuf:"varint,6,opt,name=database_idx,json=databaseIdx,proto3" json:"database_idx,omitempty"` - HasQueryIdx bool `protobuf:"varint,7,opt,name=has_query_idx,json=hasQueryIdx,proto3" json:"has_query_idx,omitempty"` - QueryIdx int32 `protobuf:"varint,8,opt,name=query_idx,json=queryIdx,proto3" json:"query_idx,omitempty"` - QueryText string `protobuf:"bytes,9,opt,name=query_text,json=queryText,proto3" json:"query_text,omitempty"` - ApplicationName string `protobuf:"bytes,10,opt,name=application_name,json=applicationName,proto3" json:"application_name,omitempty"` - ClientAddr string `protobuf:"bytes,11,opt,name=client_addr,json=clientAddr,proto3" json:"client_addr,omitempty"` - ClientPort int32 `protobuf:"varint,12,opt,name=client_port,json=clientPort,proto3" json:"client_port,omitempty"` - BackendStart *timestamp.Timestamp `protobuf:"bytes,13,opt,name=backend_start,json=backendStart,proto3" json:"backend_start,omitempty"` - XactStart *timestamp.Timestamp `protobuf:"bytes,14,opt,name=xact_start,json=xactStart,proto3" json:"xact_start,omitempty"` - QueryStart *timestamp.Timestamp `protobuf:"bytes,15,opt,name=query_start,json=queryStart,proto3" json:"query_start,omitempty"` - StateChange *timestamp.Timestamp `protobuf:"bytes,16,opt,name=state_change,json=stateChange,proto3" json:"state_change,omitempty"` - Waiting bool `protobuf:"varint,17,opt,name=waiting,proto3" json:"waiting,omitempty"` - State string `protobuf:"bytes,18,opt,name=state,proto3" json:"state,omitempty"` - WaitEventType string `protobuf:"bytes,19,opt,name=wait_event_type,json=waitEventType,proto3" json:"wait_event_type,omitempty"` - WaitEvent string `protobuf:"bytes,20,opt,name=wait_event,json=waitEvent,proto3" json:"wait_event,omitempty"` - BackendType string `protobuf:"bytes,21,opt,name=backend_type,json=backendType,proto3" json:"backend_type,omitempty"` - BlockedByPids []int32 `protobuf:"varint,22,rep,packed,name=blocked_by_pids,json=blockedByPids,proto3" json:"blocked_by_pids,omitempty"` + Identity uint64 `protobuf:"varint,1,opt,name=identity,proto3" json:"identity,omitempty"` // Server-wide unique identifier (backend_start + PID) + Pid int32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + HasRoleIdx bool `protobuf:"varint,3,opt,name=has_role_idx,json=hasRoleIdx,proto3" json:"has_role_idx,omitempty"` + RoleIdx int32 `protobuf:"varint,4,opt,name=role_idx,json=roleIdx,proto3" json:"role_idx,omitempty"` + HasDatabaseIdx bool `protobuf:"varint,5,opt,name=has_database_idx,json=hasDatabaseIdx,proto3" json:"has_database_idx,omitempty"` + DatabaseIdx int32 `protobuf:"varint,6,opt,name=database_idx,json=databaseIdx,proto3" json:"database_idx,omitempty"` + HasQueryIdx bool `protobuf:"varint,7,opt,name=has_query_idx,json=hasQueryIdx,proto3" json:"has_query_idx,omitempty"` + QueryIdx int32 `protobuf:"varint,8,opt,name=query_idx,json=queryIdx,proto3" json:"query_idx,omitempty"` + QueryText string `protobuf:"bytes,9,opt,name=query_text,json=queryText,proto3" json:"query_text,omitempty"` + ApplicationName string `protobuf:"bytes,10,opt,name=application_name,json=applicationName,proto3" json:"application_name,omitempty"` + ClientAddr string `protobuf:"bytes,11,opt,name=client_addr,json=clientAddr,proto3" json:"client_addr,omitempty"` + ClientPort int32 `protobuf:"varint,12,opt,name=client_port,json=clientPort,proto3" json:"client_port,omitempty"` + BackendStart *timestamppb.Timestamp `protobuf:"bytes,13,opt,name=backend_start,json=backendStart,proto3" json:"backend_start,omitempty"` + XactStart *timestamppb.Timestamp `protobuf:"bytes,14,opt,name=xact_start,json=xactStart,proto3" json:"xact_start,omitempty"` + QueryStart *timestamppb.Timestamp `protobuf:"bytes,15,opt,name=query_start,json=queryStart,proto3" json:"query_start,omitempty"` + StateChange *timestamppb.Timestamp `protobuf:"bytes,16,opt,name=state_change,json=stateChange,proto3" json:"state_change,omitempty"` + Waiting bool `protobuf:"varint,17,opt,name=waiting,proto3" json:"waiting,omitempty"` + State string `protobuf:"bytes,18,opt,name=state,proto3" json:"state,omitempty"` + WaitEventType string `protobuf:"bytes,19,opt,name=wait_event_type,json=waitEventType,proto3" json:"wait_event_type,omitempty"` + WaitEvent string `protobuf:"bytes,20,opt,name=wait_event,json=waitEvent,proto3" json:"wait_event,omitempty"` + BackendType string `protobuf:"bytes,21,opt,name=backend_type,json=backendType,proto3" json:"backend_type,omitempty"` + BlockedByPids []int32 `protobuf:"varint,22,rep,packed,name=blocked_by_pids,json=blockedByPids,proto3" json:"blocked_by_pids,omitempty"` } func (x *Backend) Reset() { @@ -1149,28 +1144,28 @@ func (x *Backend) GetClientPort() int32 { return 0 } -func (x *Backend) GetBackendStart() *timestamp.Timestamp { +func (x *Backend) GetBackendStart() *timestamppb.Timestamp { if x != nil { return x.BackendStart } return nil } -func (x *Backend) GetXactStart() *timestamp.Timestamp { +func (x *Backend) GetXactStart() *timestamppb.Timestamp { if x != nil { return x.XactStart } return nil } -func (x *Backend) GetQueryStart() *timestamp.Timestamp { +func (x *Backend) GetQueryStart() *timestamppb.Timestamp { if x != nil { return x.QueryStart } return nil } -func (x *Backend) GetStateChange() *timestamp.Timestamp { +func (x *Backend) GetStateChange() *timestamppb.Timestamp { if x != nil { return x.StateChange } @@ -1224,14 +1219,14 @@ type VacuumProgressInformation struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - VacuumIdentity uint64 `protobuf:"varint,1,opt,name=vacuum_identity,json=vacuumIdentity,proto3" json:"vacuum_identity,omitempty"` // Server-wide unique identifier for this vacuum run (query_start + PID) - RoleIdx int32 `protobuf:"varint,2,opt,name=role_idx,json=roleIdx,proto3" json:"role_idx,omitempty"` - DatabaseIdx int32 `protobuf:"varint,3,opt,name=database_idx,json=databaseIdx,proto3" json:"database_idx,omitempty"` - RelationIdx int32 `protobuf:"varint,4,opt,name=relation_idx,json=relationIdx,proto3" json:"relation_idx,omitempty"` - BackendIdentity uint64 `protobuf:"varint,5,opt,name=backend_identity,json=backendIdentity,proto3" json:"backend_identity,omitempty"` - StartedAt *timestamp.Timestamp `protobuf:"bytes,6,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"` - Autovacuum bool `protobuf:"varint,7,opt,name=autovacuum,proto3" json:"autovacuum,omitempty"` - Toast bool `protobuf:"varint,8,opt,name=toast,proto3" json:"toast,omitempty"` + VacuumIdentity uint64 `protobuf:"varint,1,opt,name=vacuum_identity,json=vacuumIdentity,proto3" json:"vacuum_identity,omitempty"` // Server-wide unique identifier for this vacuum run (query_start + PID) + RoleIdx int32 `protobuf:"varint,2,opt,name=role_idx,json=roleIdx,proto3" json:"role_idx,omitempty"` + DatabaseIdx int32 `protobuf:"varint,3,opt,name=database_idx,json=databaseIdx,proto3" json:"database_idx,omitempty"` + RelationIdx int32 `protobuf:"varint,4,opt,name=relation_idx,json=relationIdx,proto3" json:"relation_idx,omitempty"` + BackendIdentity uint64 `protobuf:"varint,5,opt,name=backend_identity,json=backendIdentity,proto3" json:"backend_identity,omitempty"` + StartedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"` + Autovacuum bool `protobuf:"varint,7,opt,name=autovacuum,proto3" json:"autovacuum,omitempty"` + Toast bool `protobuf:"varint,8,opt,name=toast,proto3" json:"toast,omitempty"` } func (x *VacuumProgressInformation) Reset() { @@ -1301,7 +1296,7 @@ func (x *VacuumProgressInformation) GetBackendIdentity() uint64 { return 0 } -func (x *VacuumProgressInformation) GetStartedAt() *timestamp.Timestamp { +func (x *VacuumProgressInformation) GetStartedAt() *timestamppb.Timestamp { if x != nil { return x.StartedAt } @@ -2155,7 +2150,11 @@ var file_compact_activity_snapshot_proto_rawDesc = []byte{ 0x0a, 0x0d, 0x49, 0x4e, 0x44, 0x45, 0x58, 0x5f, 0x43, 0x4c, 0x45, 0x41, 0x4e, 0x55, 0x50, 0x10, 0x04, 0x12, 0x0c, 0x0a, 0x08, 0x54, 0x52, 0x55, 0x4e, 0x43, 0x41, 0x54, 0x45, 0x10, 0x05, 0x12, 0x11, 0x0a, 0x0d, 0x46, 0x49, 0x4e, 0x41, 0x4c, 0x5f, 0x43, 0x4c, 0x45, 0x41, 0x4e, 0x55, 0x50, - 0x10, 0x06, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x10, 0x06, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2f, 0x70, 0x67, 0x61, 0x6e, + 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2181,7 +2180,7 @@ var file_compact_activity_snapshot_proto_goTypes = []interface{}{ (*VacuumProgressInformation)(nil), // 5: pganalyze.collector.VacuumProgressInformation (*VacuumProgressStatistic)(nil), // 6: pganalyze.collector.VacuumProgressStatistic (*PostgresVersion)(nil), // 7: pganalyze.collector.PostgresVersion - (*timestamp.Timestamp)(nil), // 8: google.protobuf.Timestamp + (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp } var file_compact_activity_snapshot_proto_depIdxs = []int32{ 7, // 0: pganalyze.collector.CompactActivitySnapshot.postgres_version:type_name -> pganalyze.collector.PostgresVersion diff --git a/output/pganalyze_collector/compact_log_snapshot.pb.go b/output/pganalyze_collector/compact_log_snapshot.pb.go index 4509b25f..7a466176 100644 --- a/output/pganalyze_collector/compact_log_snapshot.pb.go +++ b/output/pganalyze_collector/compact_log_snapshot.pb.go @@ -1,16 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.14.0 // source: compact_log_snapshot.proto package pganalyze_collector import ( - proto "github.com/golang/protobuf/proto" - timestamp "github.com/golang/protobuf/ptypes/timestamp" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type LogFileReference_LogSecretKind int32 const ( @@ -792,7 +787,7 @@ type LogLineInformation struct { DatabaseIdx int32 `protobuf:"varint,10,opt,name=database_idx,json=databaseIdx,proto3" json:"database_idx,omitempty"` HasQueryIdx bool `protobuf:"varint,11,opt,name=has_query_idx,json=hasQueryIdx,proto3" json:"has_query_idx,omitempty"` QueryIdx int32 `protobuf:"varint,12,opt,name=query_idx,json=queryIdx,proto3" json:"query_idx,omitempty"` - OccurredAt *timestamp.Timestamp `protobuf:"bytes,13,opt,name=occurred_at,json=occurredAt,proto3" json:"occurred_at,omitempty"` + OccurredAt *timestamppb.Timestamp `protobuf:"bytes,13,opt,name=occurred_at,json=occurredAt,proto3" json:"occurred_at,omitempty"` BackendPid int32 `protobuf:"varint,14,opt,name=backend_pid,json=backendPid,proto3" json:"backend_pid,omitempty"` Level LogLineInformation_LogLevel `protobuf:"varint,15,opt,name=level,proto3,enum=pganalyze.collector.LogLineInformation_LogLevel" json:"level,omitempty"` Classification LogLineInformation_LogClassification `protobuf:"varint,16,opt,name=classification,proto3,enum=pganalyze.collector.LogLineInformation_LogClassification" json:"classification,omitempty"` @@ -918,7 +913,7 @@ func (x *LogLineInformation) GetQueryIdx() int32 { return 0 } -func (x *LogLineInformation) GetOccurredAt() *timestamp.Timestamp { +func (x *LogLineInformation) GetOccurredAt() *timestamppb.Timestamp { if x != nil { return x.OccurredAt } @@ -979,13 +974,13 @@ type QuerySample struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - QueryIdx int32 `protobuf:"varint,1,opt,name=query_idx,json=queryIdx,proto3" json:"query_idx,omitempty"` - OccurredAt *timestamp.Timestamp `protobuf:"bytes,2,opt,name=occurred_at,json=occurredAt,proto3" json:"occurred_at,omitempty"` - RuntimeMs float64 `protobuf:"fixed64,3,opt,name=runtime_ms,json=runtimeMs,proto3" json:"runtime_ms,omitempty"` - QueryText string `protobuf:"bytes,4,opt,name=query_text,json=queryText,proto3" json:"query_text,omitempty"` - ParametersLegacy []string `protobuf:"bytes,5,rep,name=parameters_legacy,json=parametersLegacy,proto3" json:"parameters_legacy,omitempty"` // Deprecated as of Dec 2020, but may still used by older versions of the app - Parameters []*NullString `protobuf:"bytes,6,rep,name=parameters,proto3" json:"parameters,omitempty"` - LogLineUuid string `protobuf:"bytes,10,opt,name=log_line_uuid,json=logLineUuid,proto3" json:"log_line_uuid,omitempty"` + QueryIdx int32 `protobuf:"varint,1,opt,name=query_idx,json=queryIdx,proto3" json:"query_idx,omitempty"` + OccurredAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=occurred_at,json=occurredAt,proto3" json:"occurred_at,omitempty"` + RuntimeMs float64 `protobuf:"fixed64,3,opt,name=runtime_ms,json=runtimeMs,proto3" json:"runtime_ms,omitempty"` + QueryText string `protobuf:"bytes,4,opt,name=query_text,json=queryText,proto3" json:"query_text,omitempty"` + ParametersLegacy []string `protobuf:"bytes,5,rep,name=parameters_legacy,json=parametersLegacy,proto3" json:"parameters_legacy,omitempty"` // Deprecated as of Dec 2020, but may still used by older versions of the app + Parameters []*NullString `protobuf:"bytes,6,rep,name=parameters,proto3" json:"parameters,omitempty"` + LogLineUuid string `protobuf:"bytes,10,opt,name=log_line_uuid,json=logLineUuid,proto3" json:"log_line_uuid,omitempty"` // Note: For historic reasons this contains an inline version of QueryExplainInformation HasExplain bool `protobuf:"varint,20,opt,name=has_explain,json=hasExplain,proto3" json:"has_explain,omitempty"` ExplainOutput string `protobuf:"bytes,21,opt,name=explain_output,json=explainOutput,proto3" json:"explain_output,omitempty"` @@ -1033,7 +1028,7 @@ func (x *QuerySample) GetQueryIdx() int32 { return 0 } -func (x *QuerySample) GetOccurredAt() *timestamp.Timestamp { +func (x *QuerySample) GetOccurredAt() *timestamppb.Timestamp { if x != nil { return x.OccurredAt } @@ -1461,7 +1456,11 @@ var file_compact_log_snapshot_proto_rawDesc = []byte{ 0x17, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x45, 0x58, 0x50, 0x4c, 0x41, 0x49, 0x4e, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x49, 0x43, 0x5f, 0x45, 0x58, 0x50, 0x4c, 0x41, 0x49, 0x4e, 0x5f, 0x53, 0x4f, - 0x55, 0x52, 0x43, 0x45, 0x10, 0x03, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x55, 0x52, 0x43, 0x45, 0x10, 0x03, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x2f, 0x63, + 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2f, + 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1488,7 +1487,7 @@ var file_compact_log_snapshot_proto_goTypes = []interface{}{ (*LogFileReference)(nil), // 6: pganalyze.collector.LogFileReference (*LogLineInformation)(nil), // 7: pganalyze.collector.LogLineInformation (*QuerySample)(nil), // 8: pganalyze.collector.QuerySample - (*timestamp.Timestamp)(nil), // 9: google.protobuf.Timestamp + (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp (*NullString)(nil), // 10: pganalyze.collector.NullString } var file_compact_log_snapshot_proto_depIdxs = []int32{ diff --git a/output/pganalyze_collector/compact_snapshot.pb.go b/output/pganalyze_collector/compact_snapshot.pb.go index a6011523..8dad0bb0 100644 --- a/output/pganalyze_collector/compact_snapshot.pb.go +++ b/output/pganalyze_collector/compact_snapshot.pb.go @@ -1,16 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.14.0 // source: compact_snapshot.proto package pganalyze_collector import ( - proto "github.com/golang/protobuf/proto" - timestamp "github.com/golang/protobuf/ptypes/timestamp" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type CompactSnapshot struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -36,7 +31,7 @@ type CompactSnapshot struct { SnapshotVersionMinor int32 `protobuf:"varint,2,opt,name=snapshot_version_minor,json=snapshotVersionMinor,proto3" json:"snapshot_version_minor,omitempty"` CollectorVersion string `protobuf:"bytes,3,opt,name=collector_version,json=collectorVersion,proto3" json:"collector_version,omitempty"` SnapshotUuid string `protobuf:"bytes,4,opt,name=snapshot_uuid,json=snapshotUuid,proto3" json:"snapshot_uuid,omitempty"` - CollectedAt *timestamp.Timestamp `protobuf:"bytes,5,opt,name=collected_at,json=collectedAt,proto3" json:"collected_at,omitempty"` + CollectedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=collected_at,json=collectedAt,proto3" json:"collected_at,omitempty"` BaseRefs *CompactSnapshot_BaseRefs `protobuf:"bytes,6,opt,name=base_refs,json=baseRefs,proto3" json:"base_refs,omitempty"` // Types that are assignable to Data: // @@ -106,7 +101,7 @@ func (x *CompactSnapshot) GetSnapshotUuid() string { return "" } -func (x *CompactSnapshot) GetCollectedAt() *timestamp.Timestamp { +func (x *CompactSnapshot) GetCollectedAt() *timestamppb.Timestamp { if x != nil { return x.CollectedAt } @@ -329,7 +324,11 @@ var file_compact_snapshot_proto_rawDesc = []byte{ 0x74, 0x6f, 0x72, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x12, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x42, 0x06, 0x0a, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x2f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2f, 0x70, 0x67, 0x61, 0x6e, 0x61, + 0x6c, 0x79, 0x7a, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -348,7 +347,7 @@ var file_compact_snapshot_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_compact_snapshot_proto_goTypes = []interface{}{ (*CompactSnapshot)(nil), // 0: pganalyze.collector.CompactSnapshot (*CompactSnapshot_BaseRefs)(nil), // 1: pganalyze.collector.CompactSnapshot.BaseRefs - (*timestamp.Timestamp)(nil), // 2: google.protobuf.Timestamp + (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp (*CompactLogSnapshot)(nil), // 3: pganalyze.collector.CompactLogSnapshot (*CompactSystemSnapshot)(nil), // 4: pganalyze.collector.CompactSystemSnapshot (*CompactActivitySnapshot)(nil), // 5: pganalyze.collector.CompactActivitySnapshot diff --git a/output/pganalyze_collector/compact_system_snapshot.pb.go b/output/pganalyze_collector/compact_system_snapshot.pb.go index 470018e4..479f77b5 100644 --- a/output/pganalyze_collector/compact_system_snapshot.pb.go +++ b/output/pganalyze_collector/compact_system_snapshot.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.14.0 // source: compact_system_snapshot.proto package pganalyze_collector import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type CompactSystemSnapshot struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -84,7 +79,11 @@ var file_compact_system_snapshot_proto_rawDesc = []byte{ 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x06, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, + 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x2f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2f, 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, + 0x79, 0x7a, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/output/pganalyze_collector/full_snapshot.pb.go b/output/pganalyze_collector/full_snapshot.pb.go index c691894e..17562707 100644 --- a/output/pganalyze_collector/full_snapshot.pb.go +++ b/output/pganalyze_collector/full_snapshot.pb.go @@ -1,16 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.14.0 // source: full_snapshot.proto package pganalyze_collector import ( - proto "github.com/golang/protobuf/proto" - timestamp "github.com/golang/protobuf/ptypes/timestamp" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // ! When changing this, also update mappings/backend_state.json type BackendCountStatistic_BackendState int32 @@ -388,27 +383,27 @@ type FullSnapshot struct { unknownFields protoimpl.UnknownFields // Basic information about this snapshot - SnapshotVersionMajor int32 `protobuf:"varint,1,opt,name=snapshot_version_major,json=snapshotVersionMajor,proto3" json:"snapshot_version_major,omitempty"` - SnapshotVersionMinor int32 `protobuf:"varint,2,opt,name=snapshot_version_minor,json=snapshotVersionMinor,proto3" json:"snapshot_version_minor,omitempty"` - CollectorVersion string `protobuf:"bytes,3,opt,name=collector_version,json=collectorVersion,proto3" json:"collector_version,omitempty"` - FailedRun bool `protobuf:"varint,4,opt,name=failed_run,json=failedRun,proto3" json:"failed_run,omitempty"` // failed runs are submitted so we can provide more context in the UI - SnapshotUuid string `protobuf:"bytes,10,opt,name=snapshot_uuid,json=snapshotUuid,proto3" json:"snapshot_uuid,omitempty"` - CollectedAt *timestamp.Timestamp `protobuf:"bytes,11,opt,name=collected_at,json=collectedAt,proto3" json:"collected_at,omitempty"` - CollectedIntervalSecs uint32 `protobuf:"varint,12,opt,name=collected_interval_secs,json=collectedIntervalSecs,proto3" json:"collected_interval_secs,omitempty"` - Config *CollectorConfig `protobuf:"bytes,13,opt,name=config,proto3" json:"config,omitempty"` - CollectorStatistic *CollectorStatistic `protobuf:"bytes,20,opt,name=collector_statistic,json=collectorStatistic,proto3" json:"collector_statistic,omitempty"` - CollectorErrors []string `protobuf:"bytes,21,rep,name=collector_errors,json=collectorErrors,proto3" json:"collector_errors,omitempty"` // log error messages that happened during the collector run - CollectorStartedAt *timestamp.Timestamp `protobuf:"bytes,22,opt,name=collector_started_at,json=collectorStartedAt,proto3" json:"collector_started_at,omitempty"` - CollectorHostname string `protobuf:"bytes,23,opt,name=collector_hostname,json=collectorHostname,proto3" json:"collector_hostname,omitempty"` - CollectorArchitecture string `protobuf:"bytes,24,opt,name=collector_architecture,json=collectorArchitecture,proto3" json:"collector_architecture,omitempty"` - CollectorOperatingSystem string `protobuf:"bytes,25,opt,name=collector_operating_system,json=collectorOperatingSystem,proto3" json:"collector_operating_system,omitempty"` - CollectorPlatform string `protobuf:"bytes,26,opt,name=collector_platform,json=collectorPlatform,proto3" json:"collector_platform,omitempty"` - CollectorPlatformFamily string `protobuf:"bytes,27,opt,name=collector_platform_family,json=collectorPlatformFamily,proto3" json:"collector_platform_family,omitempty"` - CollectorPlatformVersion string `protobuf:"bytes,28,opt,name=collector_platform_version,json=collectorPlatformVersion,proto3" json:"collector_platform_version,omitempty"` - CollectorVirtualizationSystem string `protobuf:"bytes,29,opt,name=collector_virtualization_system,json=collectorVirtualizationSystem,proto3" json:"collector_virtualization_system,omitempty"` // Name of the virtualization system (only if we're a guest) - CollectorKernelVersion string `protobuf:"bytes,30,opt,name=collector_kernel_version,json=collectorKernelVersion,proto3" json:"collector_kernel_version,omitempty"` - CollectorLogSnapshotDisabled bool `protobuf:"varint,31,opt,name=collector_log_snapshot_disabled,json=collectorLogSnapshotDisabled,proto3" json:"collector_log_snapshot_disabled,omitempty"` - CollectorLogSnapshotDisabledReason string `protobuf:"bytes,32,opt,name=collector_log_snapshot_disabled_reason,json=collectorLogSnapshotDisabledReason,proto3" json:"collector_log_snapshot_disabled_reason,omitempty"` + SnapshotVersionMajor int32 `protobuf:"varint,1,opt,name=snapshot_version_major,json=snapshotVersionMajor,proto3" json:"snapshot_version_major,omitempty"` + SnapshotVersionMinor int32 `protobuf:"varint,2,opt,name=snapshot_version_minor,json=snapshotVersionMinor,proto3" json:"snapshot_version_minor,omitempty"` + CollectorVersion string `protobuf:"bytes,3,opt,name=collector_version,json=collectorVersion,proto3" json:"collector_version,omitempty"` + FailedRun bool `protobuf:"varint,4,opt,name=failed_run,json=failedRun,proto3" json:"failed_run,omitempty"` // failed runs are submitted so we can provide more context in the UI + SnapshotUuid string `protobuf:"bytes,10,opt,name=snapshot_uuid,json=snapshotUuid,proto3" json:"snapshot_uuid,omitempty"` + CollectedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=collected_at,json=collectedAt,proto3" json:"collected_at,omitempty"` + CollectedIntervalSecs uint32 `protobuf:"varint,12,opt,name=collected_interval_secs,json=collectedIntervalSecs,proto3" json:"collected_interval_secs,omitempty"` + Config *CollectorConfig `protobuf:"bytes,13,opt,name=config,proto3" json:"config,omitempty"` + CollectorStatistic *CollectorStatistic `protobuf:"bytes,20,opt,name=collector_statistic,json=collectorStatistic,proto3" json:"collector_statistic,omitempty"` + CollectorErrors []string `protobuf:"bytes,21,rep,name=collector_errors,json=collectorErrors,proto3" json:"collector_errors,omitempty"` // log error messages that happened during the collector run + CollectorStartedAt *timestamppb.Timestamp `protobuf:"bytes,22,opt,name=collector_started_at,json=collectorStartedAt,proto3" json:"collector_started_at,omitempty"` + CollectorHostname string `protobuf:"bytes,23,opt,name=collector_hostname,json=collectorHostname,proto3" json:"collector_hostname,omitempty"` + CollectorArchitecture string `protobuf:"bytes,24,opt,name=collector_architecture,json=collectorArchitecture,proto3" json:"collector_architecture,omitempty"` + CollectorOperatingSystem string `protobuf:"bytes,25,opt,name=collector_operating_system,json=collectorOperatingSystem,proto3" json:"collector_operating_system,omitempty"` + CollectorPlatform string `protobuf:"bytes,26,opt,name=collector_platform,json=collectorPlatform,proto3" json:"collector_platform,omitempty"` + CollectorPlatformFamily string `protobuf:"bytes,27,opt,name=collector_platform_family,json=collectorPlatformFamily,proto3" json:"collector_platform_family,omitempty"` + CollectorPlatformVersion string `protobuf:"bytes,28,opt,name=collector_platform_version,json=collectorPlatformVersion,proto3" json:"collector_platform_version,omitempty"` + CollectorVirtualizationSystem string `protobuf:"bytes,29,opt,name=collector_virtualization_system,json=collectorVirtualizationSystem,proto3" json:"collector_virtualization_system,omitempty"` // Name of the virtualization system (only if we're a guest) + CollectorKernelVersion string `protobuf:"bytes,30,opt,name=collector_kernel_version,json=collectorKernelVersion,proto3" json:"collector_kernel_version,omitempty"` + CollectorLogSnapshotDisabled bool `protobuf:"varint,31,opt,name=collector_log_snapshot_disabled,json=collectorLogSnapshotDisabled,proto3" json:"collector_log_snapshot_disabled,omitempty"` + CollectorLogSnapshotDisabledReason string `protobuf:"bytes,32,opt,name=collector_log_snapshot_disabled_reason,json=collectorLogSnapshotDisabledReason,proto3" json:"collector_log_snapshot_disabled_reason,omitempty"` // Per server (and hence snapshot) System *System `protobuf:"bytes,100,opt,name=system,proto3" json:"system,omitempty"` PostgresVersion *PostgresVersion `protobuf:"bytes,101,opt,name=postgres_version,json=postgresVersion,proto3" json:"postgres_version,omitempty"` @@ -510,7 +505,7 @@ func (x *FullSnapshot) GetSnapshotUuid() string { return "" } -func (x *FullSnapshot) GetCollectedAt() *timestamp.Timestamp { +func (x *FullSnapshot) GetCollectedAt() *timestamppb.Timestamp { if x != nil { return x.CollectedAt } @@ -545,7 +540,7 @@ func (x *FullSnapshot) GetCollectorErrors() []string { return nil } -func (x *FullSnapshot) GetCollectorStartedAt() *timestamp.Timestamp { +func (x *FullSnapshot) GetCollectorStartedAt() *timestamppb.Timestamp { if x != nil { return x.CollectorStartedAt } @@ -1561,12 +1556,12 @@ type Replication struct { StandbyInformations []*StandbyInformation `protobuf:"bytes,12,rep,name=standby_informations,json=standbyInformations,proto3" json:"standby_informations,omitempty"` StandbyStatistics []*StandbyStatistic `protobuf:"bytes,13,rep,name=standby_statistics,json=standbyStatistics,proto3" json:"standby_statistics,omitempty"` // Standby information - IsStreaming bool `protobuf:"varint,20,opt,name=is_streaming,json=isStreaming,proto3" json:"is_streaming,omitempty"` - ReceiveLocation string `protobuf:"bytes,21,opt,name=receive_location,json=receiveLocation,proto3" json:"receive_location,omitempty"` - ReplayLocation string `protobuf:"bytes,22,opt,name=replay_location,json=replayLocation,proto3" json:"replay_location,omitempty"` - ApplyByteLag int64 `protobuf:"varint,23,opt,name=apply_byte_lag,json=applyByteLag,proto3" json:"apply_byte_lag,omitempty"` - ReplayTimestamp *timestamp.Timestamp `protobuf:"bytes,24,opt,name=replay_timestamp,json=replayTimestamp,proto3" json:"replay_timestamp,omitempty"` - ReplayTimestampAge int64 `protobuf:"varint,25,opt,name=replay_timestamp_age,json=replayTimestampAge,proto3" json:"replay_timestamp_age,omitempty"` // in seconds + IsStreaming bool `protobuf:"varint,20,opt,name=is_streaming,json=isStreaming,proto3" json:"is_streaming,omitempty"` + ReceiveLocation string `protobuf:"bytes,21,opt,name=receive_location,json=receiveLocation,proto3" json:"receive_location,omitempty"` + ReplayLocation string `protobuf:"bytes,22,opt,name=replay_location,json=replayLocation,proto3" json:"replay_location,omitempty"` + ApplyByteLag int64 `protobuf:"varint,23,opt,name=apply_byte_lag,json=applyByteLag,proto3" json:"apply_byte_lag,omitempty"` + ReplayTimestamp *timestamppb.Timestamp `protobuf:"bytes,24,opt,name=replay_timestamp,json=replayTimestamp,proto3" json:"replay_timestamp,omitempty"` + ReplayTimestampAge int64 `protobuf:"varint,25,opt,name=replay_timestamp_age,json=replayTimestampAge,proto3" json:"replay_timestamp_age,omitempty"` // in seconds } func (x *Replication) Reset() { @@ -1664,7 +1659,7 @@ func (x *Replication) GetApplyByteLag() int64 { return 0 } -func (x *Replication) GetReplayTimestamp() *timestamp.Timestamp { +func (x *Replication) GetReplayTimestamp() *timestamppb.Timestamp { if x != nil { return x.ReplayTimestamp } @@ -1730,15 +1725,15 @@ type StandbyInformation struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - StandbyIdx int32 `protobuf:"varint,1,opt,name=standby_idx,json=standbyIdx,proto3" json:"standby_idx,omitempty"` - RoleIdx int32 `protobuf:"varint,2,opt,name=role_idx,json=roleIdx,proto3" json:"role_idx,omitempty"` - Pid int64 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` - ApplicationName string `protobuf:"bytes,4,opt,name=application_name,json=applicationName,proto3" json:"application_name,omitempty"` - ClientHostname string `protobuf:"bytes,5,opt,name=client_hostname,json=clientHostname,proto3" json:"client_hostname,omitempty"` - ClientPort int32 `protobuf:"varint,6,opt,name=client_port,json=clientPort,proto3" json:"client_port,omitempty"` - BackendStart *timestamp.Timestamp `protobuf:"bytes,7,opt,name=backend_start,json=backendStart,proto3" json:"backend_start,omitempty"` - SyncPriority int32 `protobuf:"varint,8,opt,name=sync_priority,json=syncPriority,proto3" json:"sync_priority,omitempty"` - SyncState string `protobuf:"bytes,9,opt,name=sync_state,json=syncState,proto3" json:"sync_state,omitempty"` + StandbyIdx int32 `protobuf:"varint,1,opt,name=standby_idx,json=standbyIdx,proto3" json:"standby_idx,omitempty"` + RoleIdx int32 `protobuf:"varint,2,opt,name=role_idx,json=roleIdx,proto3" json:"role_idx,omitempty"` + Pid int64 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` + ApplicationName string `protobuf:"bytes,4,opt,name=application_name,json=applicationName,proto3" json:"application_name,omitempty"` + ClientHostname string `protobuf:"bytes,5,opt,name=client_hostname,json=clientHostname,proto3" json:"client_hostname,omitempty"` + ClientPort int32 `protobuf:"varint,6,opt,name=client_port,json=clientPort,proto3" json:"client_port,omitempty"` + BackendStart *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=backend_start,json=backendStart,proto3" json:"backend_start,omitempty"` + SyncPriority int32 `protobuf:"varint,8,opt,name=sync_priority,json=syncPriority,proto3" json:"sync_priority,omitempty"` + SyncState string `protobuf:"bytes,9,opt,name=sync_state,json=syncState,proto3" json:"sync_state,omitempty"` } func (x *StandbyInformation) Reset() { @@ -1815,7 +1810,7 @@ func (x *StandbyInformation) GetClientPort() int32 { return 0 } -func (x *StandbyInformation) GetBackendStart() *timestamp.Timestamp { +func (x *StandbyInformation) GetBackendStart() *timestamppb.Timestamp { if x != nil { return x.BackendStart } @@ -2843,9 +2838,9 @@ type HistoricQueryStatistics struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - CollectedAt *timestamp.Timestamp `protobuf:"bytes,1,opt,name=collected_at,json=collectedAt,proto3" json:"collected_at,omitempty"` - CollectedIntervalSecs uint32 `protobuf:"varint,2,opt,name=collected_interval_secs,json=collectedIntervalSecs,proto3" json:"collected_interval_secs,omitempty"` - Statistics []*QueryStatistic `protobuf:"bytes,3,rep,name=statistics,proto3" json:"statistics,omitempty"` + CollectedAt *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=collected_at,json=collectedAt,proto3" json:"collected_at,omitempty"` + CollectedIntervalSecs uint32 `protobuf:"varint,2,opt,name=collected_interval_secs,json=collectedIntervalSecs,proto3" json:"collected_interval_secs,omitempty"` + Statistics []*QueryStatistic `protobuf:"bytes,3,rep,name=statistics,proto3" json:"statistics,omitempty"` } func (x *HistoricQueryStatistics) Reset() { @@ -2880,7 +2875,7 @@ func (*HistoricQueryStatistics) Descriptor() ([]byte, []int) { return file_full_snapshot_proto_rawDescGZIP(), []int{17} } -func (x *HistoricQueryStatistics) GetCollectedAt() *timestamp.Timestamp { +func (x *HistoricQueryStatistics) GetCollectedAt() *timestamppb.Timestamp { if x != nil { return x.CollectedAt } @@ -3405,7 +3400,7 @@ type RelationEvent struct { RelationIdx int32 `protobuf:"varint,1,opt,name=relation_idx,json=relationIdx,proto3" json:"relation_idx,omitempty"` Type RelationEvent_EventType `protobuf:"varint,2,opt,name=type,proto3,enum=pganalyze.collector.RelationEvent_EventType" json:"type,omitempty"` - OccurredAt *timestamp.Timestamp `protobuf:"bytes,3,opt,name=occurred_at,json=occurredAt,proto3" json:"occurred_at,omitempty"` + OccurredAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=occurred_at,json=occurredAt,proto3" json:"occurred_at,omitempty"` ApproximateOccurredAt bool `protobuf:"varint,4,opt,name=approximate_occurred_at,json=approximateOccurredAt,proto3" json:"approximate_occurred_at,omitempty"` // In case the "occurred_at" field is approximate, because more than one kind of this event happened during the snapshot } @@ -3455,7 +3450,7 @@ func (x *RelationEvent) GetType() RelationEvent_EventType { return RelationEvent_MANUAL_VACUUM } -func (x *RelationEvent) GetOccurredAt() *timestamp.Timestamp { +func (x *RelationEvent) GetOccurredAt() *timestamppb.Timestamp { if x != nil { return x.OccurredAt } @@ -5481,8 +5476,12 @@ var file_full_snapshot_proto_rawDesc = []byte{ 0x50, 0x4f, 0x53, 0x49, 0x54, 0x45, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x41, 0x53, 0x45, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x53, 0x45, 0x55, 0x44, 0x4f, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x12, 0x0e, 0x0a, 0x0a, 0x4d, 0x55, 0x4c, - 0x54, 0x49, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x54, 0x49, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x42, + 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x67, + 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x2f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2f, 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, + 0x7a, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -5537,7 +5536,7 @@ var file_full_snapshot_proto_goTypes = []interface{}{ (*RelationInformation_ColumnStatistic)(nil), // 34: pganalyze.collector.RelationInformation.ColumnStatistic (*RelationInformation_Constraint)(nil), // 35: pganalyze.collector.RelationInformation.Constraint (*CustomTypeInformation_CompositeAttr)(nil), // 36: pganalyze.collector.CustomTypeInformation.CompositeAttr - (*timestamp.Timestamp)(nil), // 37: google.protobuf.Timestamp + (*timestamppb.Timestamp)(nil), // 37: google.protobuf.Timestamp (*System)(nil), // 38: pganalyze.collector.System (*PostgresVersion)(nil), // 39: pganalyze.collector.PostgresVersion (*RoleReference)(nil), // 40: pganalyze.collector.RoleReference diff --git a/output/pganalyze_collector/null_double.go b/output/pganalyze_collector/null_double.go deleted file mode 100644 index ee6397b3..00000000 --- a/output/pganalyze_collector/null_double.go +++ /dev/null @@ -1,9 +0,0 @@ -package pganalyze_collector - -func (ns *NullDouble) Scan(value interface{}) error { - if value == nil { - return nil - } - ns.Valid = true - return convertAssign(&ns.Value, value) -} diff --git a/output/pganalyze_collector/null_helper.go b/output/pganalyze_collector/null_helper.go deleted file mode 100644 index d0656156..00000000 --- a/output/pganalyze_collector/null_helper.go +++ /dev/null @@ -1,259 +0,0 @@ -package pganalyze_collector - -import ( - "database/sql" - "database/sql/driver" - "errors" - "fmt" - "reflect" - "strconv" - "time" -) - -var errNilPtr = errors.New("destination pointer is nil") // embedded in descriptive error - -// convertAssign copies to dest the value in src, converting it if possible. -// An error is returned if the copy would result in loss of information. -// dest should be a pointer type. -func convertAssign(dest, src interface{}) error { - // Common cases, without reflect. - switch s := src.(type) { - case string: - switch d := dest.(type) { - case *string: - if d == nil { - return errNilPtr - } - *d = s - return nil - case *[]byte: - if d == nil { - return errNilPtr - } - *d = []byte(s) - return nil - } - case []byte: - switch d := dest.(type) { - case *string: - if d == nil { - return errNilPtr - } - *d = string(s) - return nil - case *interface{}: - if d == nil { - return errNilPtr - } - *d = cloneBytes(s) - return nil - case *[]byte: - if d == nil { - return errNilPtr - } - *d = cloneBytes(s) - return nil - case *sql.RawBytes: - if d == nil { - return errNilPtr - } - *d = s - return nil - } - case time.Time: - switch d := dest.(type) { - case *string: - *d = s.Format(time.RFC3339Nano) - return nil - case *[]byte: - if d == nil { - return errNilPtr - } - *d = []byte(s.Format(time.RFC3339Nano)) - return nil - } - case nil: - switch d := dest.(type) { - case *interface{}: - if d == nil { - return errNilPtr - } - *d = nil - return nil - case *[]byte: - if d == nil { - return errNilPtr - } - *d = nil - return nil - case *sql.RawBytes: - if d == nil { - return errNilPtr - } - *d = nil - return nil - } - } - - var sv reflect.Value - - switch d := dest.(type) { - case *string: - sv = reflect.ValueOf(src) - switch sv.Kind() { - case reflect.Bool, - reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, - reflect.Float32, reflect.Float64: - *d = asString(src) - return nil - } - case *[]byte: - sv = reflect.ValueOf(src) - if b, ok := asBytes(nil, sv); ok { - *d = b - return nil - } - case *sql.RawBytes: - sv = reflect.ValueOf(src) - if b, ok := asBytes([]byte(*d)[:0], sv); ok { - *d = sql.RawBytes(b) - return nil - } - case *bool: - bv, err := driver.Bool.ConvertValue(src) - if err == nil { - *d = bv.(bool) - } - return err - case *interface{}: - *d = src - return nil - } - - if scanner, ok := dest.(sql.Scanner); ok { - return scanner.Scan(src) - } - - dpv := reflect.ValueOf(dest) - if dpv.Kind() != reflect.Ptr { - return errors.New("destination not a pointer") - } - if dpv.IsNil() { - return errNilPtr - } - - if !sv.IsValid() { - sv = reflect.ValueOf(src) - } - - dv := reflect.Indirect(dpv) - if sv.IsValid() && sv.Type().AssignableTo(dv.Type()) { - dv.Set(sv) - return nil - } - - if dv.Kind() == sv.Kind() && sv.Type().ConvertibleTo(dv.Type()) { - dv.Set(sv.Convert(dv.Type())) - return nil - } - - switch dv.Kind() { - case reflect.Ptr: - if src == nil { - dv.Set(reflect.Zero(dv.Type())) - return nil - } else { - dv.Set(reflect.New(dv.Type().Elem())) - return convertAssign(dv.Interface(), src) - } - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - s := asString(src) - i64, err := strconv.ParseInt(s, 10, dv.Type().Bits()) - if err != nil { - err = strconvErr(err) - return fmt.Errorf("converting driver.Value type %T (%q) to a %s: %v", src, s, dv.Kind(), err) - } - dv.SetInt(i64) - return nil - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - s := asString(src) - u64, err := strconv.ParseUint(s, 10, dv.Type().Bits()) - if err != nil { - err = strconvErr(err) - return fmt.Errorf("converting driver.Value type %T (%q) to a %s: %v", src, s, dv.Kind(), err) - } - dv.SetUint(u64) - return nil - case reflect.Float32, reflect.Float64: - s := asString(src) - f64, err := strconv.ParseFloat(s, dv.Type().Bits()) - if err != nil { - err = strconvErr(err) - return fmt.Errorf("converting driver.Value type %T (%q) to a %s: %v", src, s, dv.Kind(), err) - } - dv.SetFloat(f64) - return nil - } - - return fmt.Errorf("unsupported Scan, storing driver.Value type %T into type %T", src, dest) -} - -func strconvErr(err error) error { - if ne, ok := err.(*strconv.NumError); ok { - return ne.Err - } - return err -} - -func cloneBytes(b []byte) []byte { - if b == nil { - return nil - } else { - c := make([]byte, len(b)) - copy(c, b) - return c - } -} - -func asString(src interface{}) string { - switch v := src.(type) { - case string: - return v - case []byte: - return string(v) - } - rv := reflect.ValueOf(src) - switch rv.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return strconv.FormatInt(rv.Int(), 10) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - return strconv.FormatUint(rv.Uint(), 10) - case reflect.Float64: - return strconv.FormatFloat(rv.Float(), 'g', -1, 64) - case reflect.Float32: - return strconv.FormatFloat(rv.Float(), 'g', -1, 32) - case reflect.Bool: - return strconv.FormatBool(rv.Bool()) - } - return fmt.Sprintf("%v", src) -} - -func asBytes(buf []byte, rv reflect.Value) (b []byte, ok bool) { - switch rv.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return strconv.AppendInt(buf, rv.Int(), 10), true - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - return strconv.AppendUint(buf, rv.Uint(), 10), true - case reflect.Float32: - return strconv.AppendFloat(buf, rv.Float(), 'g', -1, 32), true - case reflect.Float64: - return strconv.AppendFloat(buf, rv.Float(), 'g', -1, 64), true - case reflect.Bool: - return strconv.AppendBool(buf, rv.Bool()), true - case reflect.String: - s := rv.String() - return append(buf, s...), true - } - return -} diff --git a/output/pganalyze_collector/null_string.go b/output/pganalyze_collector/null_string.go deleted file mode 100644 index 6e1e6755..00000000 --- a/output/pganalyze_collector/null_string.go +++ /dev/null @@ -1,9 +0,0 @@ -package pganalyze_collector - -func (ns *NullString) Scan(value interface{}) error { - if value == nil { - return nil - } - ns.Valid = true - return convertAssign(&ns.Value, value) -} diff --git a/output/pganalyze_collector/null_timestamp.go b/output/pganalyze_collector/null_timestamp.go index 14342164..cbb250d6 100644 --- a/output/pganalyze_collector/null_timestamp.go +++ b/output/pganalyze_collector/null_timestamp.go @@ -1,8 +1,8 @@ package pganalyze_collector import ( - "github.com/golang/protobuf/ptypes" "github.com/guregu/null" + "google.golang.org/protobuf/types/known/timestamppb" ) func NullTimeToNullTimestamp(in null.Time) *NullTimestamp { @@ -10,7 +10,7 @@ func NullTimeToNullTimestamp(in null.Time) *NullTimestamp { return &NullTimestamp{Valid: false} } - ts, _ := ptypes.TimestampProto(in.Time) + ts := timestamppb.New(in.Time) return &NullTimestamp{Valid: true, Value: ts} } diff --git a/output/pganalyze_collector/report.pb.go b/output/pganalyze_collector/report.pb.go index 847ffdd9..233c29b6 100644 --- a/output/pganalyze_collector/report.pb.go +++ b/output/pganalyze_collector/report.pb.go @@ -1,16 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.14.0 // source: report.proto package pganalyze_collector import ( - proto "github.com/golang/protobuf/proto" - timestamp "github.com/golang/protobuf/ptypes/timestamp" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -22,18 +21,14 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type Report struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ReportRunId string `protobuf:"bytes,1,opt,name=report_run_id,json=reportRunId,proto3" json:"report_run_id,omitempty"` - ReportType string `protobuf:"bytes,2,opt,name=report_type,json=reportType,proto3" json:"report_type,omitempty"` - CollectedAt *timestamp.Timestamp `protobuf:"bytes,3,opt,name=collected_at,json=collectedAt,proto3" json:"collected_at,omitempty"` + ReportRunId string `protobuf:"bytes,1,opt,name=report_run_id,json=reportRunId,proto3" json:"report_run_id,omitempty"` + ReportType string `protobuf:"bytes,2,opt,name=report_type,json=reportType,proto3" json:"report_type,omitempty"` + CollectedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=collected_at,json=collectedAt,proto3" json:"collected_at,omitempty"` // Types that are assignable to Data: // // *Report_BloatReportData @@ -89,7 +84,7 @@ func (x *Report) GetReportType() string { return "" } -func (x *Report) GetCollectedAt() *timestamp.Timestamp { +func (x *Report) GetCollectedAt() *timestamppb.Timestamp { if x != nil { return x.CollectedAt } @@ -204,7 +199,11 @@ var file_report_proto_rawDesc = []byte{ 0x6f, 0x72, 0x2e, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x44, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x12, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x44, 0x61, 0x74, 0x61, 0x42, 0x06, 0x0a, 0x04, 0x64, - 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x74, 0x61, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2f, 0x70, 0x67, 0x61, + 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -222,7 +221,7 @@ func file_report_proto_rawDescGZIP() []byte { var file_report_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_report_proto_goTypes = []interface{}{ (*Report)(nil), // 0: pganalyze.collector.Report - (*timestamp.Timestamp)(nil), // 1: google.protobuf.Timestamp + (*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp (*BloatReportData)(nil), // 2: pganalyze.collector.BloatReportData (*BuffercacheReportData)(nil), // 3: pganalyze.collector.BuffercacheReportData (*VacuumReportData)(nil), // 4: pganalyze.collector.VacuumReportData diff --git a/output/pganalyze_collector/sequence_report.pb.go b/output/pganalyze_collector/sequence_report.pb.go index 8254bdff..4453d8a1 100644 --- a/output/pganalyze_collector/sequence_report.pb.go +++ b/output/pganalyze_collector/sequence_report.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.14.0 // source: sequence_report.proto package pganalyze_collector import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type SequenceReportData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -529,8 +524,11 @@ var file_sequence_report_proto_rawDesc = []byte{ 0x6d, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x08, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, + 0x65, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x6f, 0x75, 0x74, 0x70, + 0x75, 0x74, 0x2f, 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x5f, 0x63, 0x6f, 0x6c, + 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/output/pganalyze_collector/shared.pb.go b/output/pganalyze_collector/shared.pb.go index 0480fd8c..f7fc7138 100644 --- a/output/pganalyze_collector/shared.pb.go +++ b/output/pganalyze_collector/shared.pb.go @@ -1,16 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.14.0 // source: shared.proto package pganalyze_collector import ( - proto "github.com/golang/protobuf/proto" - timestamp "github.com/golang/protobuf/ptypes/timestamp" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type QueryExplainInformation_ExplainFormat int32 const ( @@ -355,8 +350,8 @@ type NullTimestamp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"` - Value *timestamp.Timestamp `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"` + Value *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } func (x *NullTimestamp) Reset() { @@ -398,7 +393,7 @@ func (x *NullTimestamp) GetValid() bool { return false } -func (x *NullTimestamp) GetValue() *timestamp.Timestamp { +func (x *NullTimestamp) GetValue() *timestamppb.Timestamp { if x != nil { return x.Value } @@ -1167,7 +1162,7 @@ type SystemInformation struct { // *SystemInformation_AmazonRds Info isSystemInformation_Info `protobuf_oneof:"info"` ResourceTags map[string]string `protobuf:"bytes,4,rep,name=resource_tags,json=resourceTags,proto3" json:"resource_tags,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - BootTime *timestamp.Timestamp `protobuf:"bytes,10,opt,name=boot_time,json=bootTime,proto3" json:"boot_time,omitempty"` // Timestamp for when the system was started (aka uptime) + BootTime *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=boot_time,json=bootTime,proto3" json:"boot_time,omitempty"` // Timestamp for when the system was started (aka uptime) } func (x *SystemInformation) Reset() { @@ -1237,7 +1232,7 @@ func (x *SystemInformation) GetResourceTags() map[string]string { return nil } -func (x *SystemInformation) GetBootTime() *timestamp.Timestamp { +func (x *SystemInformation) GetBootTime() *timestamppb.Timestamp { if x != nil { return x.BootTime } @@ -1376,32 +1371,32 @@ type SystemInformationAmazonRDS struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Region string `protobuf:"bytes,1,opt,name=region,proto3" json:"region,omitempty"` - InstanceClass string `protobuf:"bytes,2,opt,name=instance_class,json=instanceClass,proto3" json:"instance_class,omitempty"` - InstanceId string `protobuf:"bytes,3,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` - Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` - AvailabilityZone string `protobuf:"bytes,5,opt,name=availability_zone,json=availabilityZone,proto3" json:"availability_zone,omitempty"` - PubliclyAccessible bool `protobuf:"varint,6,opt,name=publicly_accessible,json=publiclyAccessible,proto3" json:"publicly_accessible,omitempty"` - MultiAz bool `protobuf:"varint,7,opt,name=multi_az,json=multiAz,proto3" json:"multi_az,omitempty"` - SecondaryAvailabilityZone string `protobuf:"bytes,8,opt,name=secondary_availability_zone,json=secondaryAvailabilityZone,proto3" json:"secondary_availability_zone,omitempty"` - CaCertificate string `protobuf:"bytes,9,opt,name=ca_certificate,json=caCertificate,proto3" json:"ca_certificate,omitempty"` - AutoMinorVersionUpgrade bool `protobuf:"varint,10,opt,name=auto_minor_version_upgrade,json=autoMinorVersionUpgrade,proto3" json:"auto_minor_version_upgrade,omitempty"` - PreferredMaintenanceWindow string `protobuf:"bytes,12,opt,name=preferred_maintenance_window,json=preferredMaintenanceWindow,proto3" json:"preferred_maintenance_window,omitempty"` - PreferredBackupWindow string `protobuf:"bytes,14,opt,name=preferred_backup_window,json=preferredBackupWindow,proto3" json:"preferred_backup_window,omitempty"` - LatestRestorableTime *timestamp.Timestamp `protobuf:"bytes,13,opt,name=latest_restorable_time,json=latestRestorableTime,proto3" json:"latest_restorable_time,omitempty"` - BackupRetentionPeriodDays int32 `protobuf:"varint,15,opt,name=backup_retention_period_days,json=backupRetentionPeriodDays,proto3" json:"backup_retention_period_days,omitempty"` - MasterUsername string `protobuf:"bytes,16,opt,name=master_username,json=masterUsername,proto3" json:"master_username,omitempty"` - InitialDbName string `protobuf:"bytes,17,opt,name=initial_db_name,json=initialDbName,proto3" json:"initial_db_name,omitempty"` - CreatedAt *timestamp.Timestamp `protobuf:"bytes,18,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - EnhancedMonitoring bool `protobuf:"varint,19,opt,name=enhanced_monitoring,json=enhancedMonitoring,proto3" json:"enhanced_monitoring,omitempty"` - PerformanceInsights bool `protobuf:"varint,20,opt,name=performance_insights,json=performanceInsights,proto3" json:"performance_insights,omitempty"` - PostgresLogExport bool `protobuf:"varint,21,opt,name=postgres_log_export,json=postgresLogExport,proto3" json:"postgres_log_export,omitempty"` - IamAuthentication bool `protobuf:"varint,22,opt,name=iam_authentication,json=iamAuthentication,proto3" json:"iam_authentication,omitempty"` - DeletionProtection bool `protobuf:"varint,23,opt,name=deletion_protection,json=deletionProtection,proto3" json:"deletion_protection,omitempty"` - ParameterApplyStatus string `protobuf:"bytes,40,opt,name=parameter_apply_status,json=parameterApplyStatus,proto3" json:"parameter_apply_status,omitempty"` - ParameterPgssEnabled bool `protobuf:"varint,41,opt,name=parameter_pgss_enabled,json=parameterPgssEnabled,proto3" json:"parameter_pgss_enabled,omitempty"` - ParameterAutoExplainEnabled bool `protobuf:"varint,42,opt,name=parameter_auto_explain_enabled,json=parameterAutoExplainEnabled,proto3" json:"parameter_auto_explain_enabled,omitempty"` - IsAuroraPostgres bool `protobuf:"varint,50,opt,name=is_aurora_postgres,json=isAuroraPostgres,proto3" json:"is_aurora_postgres,omitempty"` + Region string `protobuf:"bytes,1,opt,name=region,proto3" json:"region,omitempty"` + InstanceClass string `protobuf:"bytes,2,opt,name=instance_class,json=instanceClass,proto3" json:"instance_class,omitempty"` + InstanceId string `protobuf:"bytes,3,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` + Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` + AvailabilityZone string `protobuf:"bytes,5,opt,name=availability_zone,json=availabilityZone,proto3" json:"availability_zone,omitempty"` + PubliclyAccessible bool `protobuf:"varint,6,opt,name=publicly_accessible,json=publiclyAccessible,proto3" json:"publicly_accessible,omitempty"` + MultiAz bool `protobuf:"varint,7,opt,name=multi_az,json=multiAz,proto3" json:"multi_az,omitempty"` + SecondaryAvailabilityZone string `protobuf:"bytes,8,opt,name=secondary_availability_zone,json=secondaryAvailabilityZone,proto3" json:"secondary_availability_zone,omitempty"` + CaCertificate string `protobuf:"bytes,9,opt,name=ca_certificate,json=caCertificate,proto3" json:"ca_certificate,omitempty"` + AutoMinorVersionUpgrade bool `protobuf:"varint,10,opt,name=auto_minor_version_upgrade,json=autoMinorVersionUpgrade,proto3" json:"auto_minor_version_upgrade,omitempty"` + PreferredMaintenanceWindow string `protobuf:"bytes,12,opt,name=preferred_maintenance_window,json=preferredMaintenanceWindow,proto3" json:"preferred_maintenance_window,omitempty"` + PreferredBackupWindow string `protobuf:"bytes,14,opt,name=preferred_backup_window,json=preferredBackupWindow,proto3" json:"preferred_backup_window,omitempty"` + LatestRestorableTime *timestamppb.Timestamp `protobuf:"bytes,13,opt,name=latest_restorable_time,json=latestRestorableTime,proto3" json:"latest_restorable_time,omitempty"` + BackupRetentionPeriodDays int32 `protobuf:"varint,15,opt,name=backup_retention_period_days,json=backupRetentionPeriodDays,proto3" json:"backup_retention_period_days,omitempty"` + MasterUsername string `protobuf:"bytes,16,opt,name=master_username,json=masterUsername,proto3" json:"master_username,omitempty"` + InitialDbName string `protobuf:"bytes,17,opt,name=initial_db_name,json=initialDbName,proto3" json:"initial_db_name,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,18,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + EnhancedMonitoring bool `protobuf:"varint,19,opt,name=enhanced_monitoring,json=enhancedMonitoring,proto3" json:"enhanced_monitoring,omitempty"` + PerformanceInsights bool `protobuf:"varint,20,opt,name=performance_insights,json=performanceInsights,proto3" json:"performance_insights,omitempty"` + PostgresLogExport bool `protobuf:"varint,21,opt,name=postgres_log_export,json=postgresLogExport,proto3" json:"postgres_log_export,omitempty"` + IamAuthentication bool `protobuf:"varint,22,opt,name=iam_authentication,json=iamAuthentication,proto3" json:"iam_authentication,omitempty"` + DeletionProtection bool `protobuf:"varint,23,opt,name=deletion_protection,json=deletionProtection,proto3" json:"deletion_protection,omitempty"` + ParameterApplyStatus string `protobuf:"bytes,40,opt,name=parameter_apply_status,json=parameterApplyStatus,proto3" json:"parameter_apply_status,omitempty"` + ParameterPgssEnabled bool `protobuf:"varint,41,opt,name=parameter_pgss_enabled,json=parameterPgssEnabled,proto3" json:"parameter_pgss_enabled,omitempty"` + ParameterAutoExplainEnabled bool `protobuf:"varint,42,opt,name=parameter_auto_explain_enabled,json=parameterAutoExplainEnabled,proto3" json:"parameter_auto_explain_enabled,omitempty"` + IsAuroraPostgres bool `protobuf:"varint,50,opt,name=is_aurora_postgres,json=isAuroraPostgres,proto3" json:"is_aurora_postgres,omitempty"` } func (x *SystemInformationAmazonRDS) Reset() { @@ -1520,7 +1515,7 @@ func (x *SystemInformationAmazonRDS) GetPreferredBackupWindow() string { return "" } -func (x *SystemInformationAmazonRDS) GetLatestRestorableTime() *timestamp.Timestamp { +func (x *SystemInformationAmazonRDS) GetLatestRestorableTime() *timestamppb.Timestamp { if x != nil { return x.LatestRestorableTime } @@ -1548,7 +1543,7 @@ func (x *SystemInformationAmazonRDS) GetInitialDbName() string { return "" } -func (x *SystemInformationAmazonRDS) GetCreatedAt() *timestamp.Timestamp { +func (x *SystemInformationAmazonRDS) GetCreatedAt() *timestamppb.Timestamp { if x != nil { return x.CreatedAt } @@ -3237,8 +3232,11 @@ var file_shared_proto_rawDesc = []byte{ 0x65, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x75, 0x73, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, - 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x79, 0x74, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x79, 0x74, 0x65, 0x73, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, + 0x7a, 0x65, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x6f, 0x75, 0x74, + 0x70, 0x75, 0x74, 0x2f, 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x5f, 0x63, 0x6f, + 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3290,7 +3288,7 @@ var file_shared_proto_goTypes = []interface{}{ (*DiskPartitionInformation)(nil), // 31: pganalyze.collector.DiskPartitionInformation (*DiskPartitionStatistic)(nil), // 32: pganalyze.collector.DiskPartitionStatistic nil, // 33: pganalyze.collector.SystemInformation.ResourceTagsEntry - (*timestamp.Timestamp)(nil), // 34: google.protobuf.Timestamp + (*timestamppb.Timestamp)(nil), // 34: google.protobuf.Timestamp } var file_shared_proto_depIdxs = []int32{ 34, // 0: pganalyze.collector.NullTimestamp.value:type_name -> google.protobuf.Timestamp diff --git a/output/pganalyze_collector/vacuum_report.pb.go b/output/pganalyze_collector/vacuum_report.pb.go index 45cc66c5..ff945df1 100644 --- a/output/pganalyze_collector/vacuum_report.pb.go +++ b/output/pganalyze_collector/vacuum_report.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.28.1 // protoc v3.14.0 // source: vacuum_report.proto package pganalyze_collector import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type VacuumReportData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -399,7 +394,11 @@ var file_vacuum_report_proto_rawDesc = []byte{ 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x63, 0x75, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x73, 0x74, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x19, 0x61, 0x75, 0x74, 0x6f, 0x76, 0x61, 0x63, 0x75, 0x75, 0x6d, 0x56, 0x61, 0x63, 0x75, 0x75, 0x6d, 0x43, 0x6f, 0x73, 0x74, - 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x2f, 0x63, 0x6f, + 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2f, 0x70, + 0x67, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/output/report.go b/output/report.go index d5c7ba0d..3fdf63ab 100644 --- a/output/report.go +++ b/output/report.go @@ -9,10 +9,10 @@ import ( "net/url" "strings" - "github.com/golang/protobuf/proto" "github.com/pganalyze/collector/reports" "github.com/pganalyze/collector/state" "github.com/pganalyze/collector/util" + "google.golang.org/protobuf/proto" ) func submitReportRun(server *state.Server, report reports.Report, logger *util.Logger, s3Location string) error { diff --git a/output/transform/activity.go b/output/transform/activity.go index 453db5b3..521e2bbc 100644 --- a/output/transform/activity.go +++ b/output/transform/activity.go @@ -1,9 +1,9 @@ package transform import ( - "github.com/golang/protobuf/ptypes" snapshot "github.com/pganalyze/collector/output/pganalyze_collector" "github.com/pganalyze/collector/state" + "google.golang.org/protobuf/types/known/timestamppb" ) func ActivityStateToCompactActivitySnapshot(server *state.Server, activityState state.TransientActivityState) (snapshot.CompactActivitySnapshot, snapshot.CompactSnapshot_BaseRefs) { @@ -11,7 +11,7 @@ func ActivityStateToCompactActivitySnapshot(server *state.Server, activityState var r snapshot.CompactSnapshot_BaseRefs if !server.ActivityPrevState.ActivitySnapshotAt.IsZero() { - s.PrevActivitySnapshotAt, _ = ptypes.TimestampProto(server.ActivityPrevState.ActivitySnapshotAt) + s.PrevActivitySnapshotAt = timestamppb.New(server.ActivityPrevState.ActivitySnapshotAt) } for _, backend := range activityState.Backends { @@ -65,7 +65,7 @@ func ActivityStateToCompactActivitySnapshot(server *state.Server, activityState vacuumInfo.RelationIdx = -1 } - vacuumInfo.StartedAt, _ = ptypes.TimestampProto(vacuum.StartedAt) + vacuumInfo.StartedAt = timestamppb.New(vacuum.StartedAt) s.VacuumProgressInformations = append(s.VacuumProgressInformations, &vacuumInfo) diff --git a/output/transform/collector_platform.go b/output/transform/collector_platform.go index e9b04e75..0244e887 100644 --- a/output/transform/collector_platform.go +++ b/output/transform/collector_platform.go @@ -1,14 +1,14 @@ package transform import ( - "github.com/golang/protobuf/ptypes" snapshot "github.com/pganalyze/collector/output/pganalyze_collector" "github.com/pganalyze/collector/state" + "google.golang.org/protobuf/types/known/timestamppb" ) func transformCollectorPlatform(s snapshot.FullSnapshot, state state.TransientState) snapshot.FullSnapshot { p := state.CollectorPlatform - startTs, _ := ptypes.TimestampProto(p.StartedAt) + startTs := timestamppb.New(p.StartedAt) s.CollectorStartedAt = startTs s.CollectorArchitecture = p.Architecture s.CollectorHostname = p.Hostname diff --git a/output/transform/logs.go b/output/transform/logs.go index f88e2590..2ab01a67 100644 --- a/output/transform/logs.go +++ b/output/transform/logs.go @@ -4,10 +4,10 @@ import ( "encoding/json" "fmt" - "github.com/golang/protobuf/ptypes" snapshot "github.com/pganalyze/collector/output/pganalyze_collector" "github.com/pganalyze/collector/state" uuid "github.com/satori/go.uuid" + "google.golang.org/protobuf/types/known/timestamppb" ) func LogStateToLogSnapshot(server *state.Server, logState state.TransientLogState) (snapshot.CompactLogSnapshot, snapshot.CompactSnapshot_BaseRefs) { @@ -20,7 +20,7 @@ func LogStateToLogSnapshot(server *state.Server, logState state.TransientLogStat func transformPostgresQuerySamples(server *state.Server, s snapshot.CompactLogSnapshot, r snapshot.CompactSnapshot_BaseRefs, logState state.TransientLogState) (snapshot.CompactLogSnapshot, snapshot.CompactSnapshot_BaseRefs) { for _, sampleIn := range logState.QuerySamples { - occurredAt, _ := ptypes.TimestampProto(sampleIn.OccurredAt) + occurredAt := timestamppb.New(sampleIn.OccurredAt) if sampleIn.Query == "" { continue @@ -135,7 +135,7 @@ func transformSystemLogs(server *state.Server, s snapshot.CompactLogSnapshot, r } func transformSystemLogLine(server *state.Server, r *snapshot.CompactSnapshot_BaseRefs, logFileIdx int32, logLineIn state.LogLine) snapshot.LogLineInformation { - occurredAt, _ := ptypes.TimestampProto(logLineIn.OccurredAt) + occurredAt := timestamppb.New(logLineIn.OccurredAt) logLine := snapshot.LogLineInformation{ LogFileIdx: logFileIdx, diff --git a/output/transform/postgres_backends.go b/output/transform/postgres_backends.go index 6186f3a5..64caacc3 100644 --- a/output/transform/postgres_backends.go +++ b/output/transform/postgres_backends.go @@ -1,9 +1,9 @@ package transform import ( - "github.com/golang/protobuf/ptypes" snapshot "github.com/pganalyze/collector/output/pganalyze_collector" "github.com/pganalyze/collector/state" + "google.golang.org/protobuf/types/known/timestamppb" ) func transformBackendWithoutRefs(backend state.PostgresBackend) snapshot.Backend { @@ -22,19 +22,19 @@ func transformBackendWithoutRefs(backend state.PostgresBackend) snapshot.Backend } if backend.BackendStart.Valid { - b.BackendStart, _ = ptypes.TimestampProto(backend.BackendStart.Time) + b.BackendStart = timestamppb.New(backend.BackendStart.Time) } if backend.XactStart.Valid { - b.XactStart, _ = ptypes.TimestampProto(backend.XactStart.Time) + b.XactStart = timestamppb.New(backend.XactStart.Time) } if backend.QueryStart.Valid { - b.QueryStart, _ = ptypes.TimestampProto(backend.QueryStart.Time) + b.QueryStart = timestamppb.New(backend.QueryStart.Time) } if backend.StateChange.Valid { - b.StateChange, _ = ptypes.TimestampProto(backend.StateChange.Time) + b.StateChange = timestamppb.New(backend.StateChange.Time) } if backend.Waiting.Valid { diff --git a/output/transform/postgres_relations.go b/output/transform/postgres_relations.go index b1098b0b..74a3cb0f 100644 --- a/output/transform/postgres_relations.go +++ b/output/transform/postgres_relations.go @@ -1,10 +1,10 @@ package transform import ( - "github.com/golang/protobuf/ptypes" "github.com/guregu/null" snapshot "github.com/pganalyze/collector/output/pganalyze_collector" "github.com/pganalyze/collector/state" + "google.golang.org/protobuf/types/known/timestamppb" ) func transformPostgresRelations(s snapshot.FullSnapshot, newState state.PersistedState, diffState state.DiffState, databaseOidToIdx OidToIdx, typeOidToIdx OidToIdx, currentXactId int64) snapshot.FullSnapshot { @@ -241,7 +241,7 @@ func addRelationEvents(relationIdx int32, events []*snapshot.RelationEvent, coun return events } - ts, _ := ptypes.TimestampProto(lastTime.Time) + ts := timestamppb.New(lastTime.Time) for i := int64(0); i < count; i++ { event := snapshot.RelationEvent{ diff --git a/output/transform/postgres_replication.go b/output/transform/postgres_replication.go index cb74b1ca..727d105e 100644 --- a/output/transform/postgres_replication.go +++ b/output/transform/postgres_replication.go @@ -1,9 +1,9 @@ package transform import ( - "github.com/golang/protobuf/ptypes" snapshot "github.com/pganalyze/collector/output/pganalyze_collector" "github.com/pganalyze/collector/state" + "google.golang.org/protobuf/types/known/timestamppb" ) func transformPostgresReplication(s snapshot.FullSnapshot, transientState state.TransientState, roleOidToIdx OidToIdx) snapshot.FullSnapshot { @@ -31,7 +31,7 @@ func transformPostgresReplication(s snapshot.FullSnapshot, transientState state. } if r.ReplayTimestamp.Valid { - s.Replication.ReplayTimestamp, _ = ptypes.TimestampProto(r.ReplayTimestamp.Time) + s.Replication.ReplayTimestamp = timestamppb.New(r.ReplayTimestamp.Time) } if r.ReplayTimestampAge.Valid { @@ -55,7 +55,7 @@ func transformPostgresReplication(s snapshot.FullSnapshot, transientState state. if standby.ClientHostname.Valid { info.ClientHostname = standby.ClientHostname.String } - info.BackendStart, _ = ptypes.TimestampProto(standby.BackendStart) + info.BackendStart = timestamppb.New(standby.BackendStart) s.Replication.StandbyInformations = append(s.Replication.StandbyInformations, info) stats := snapshot.StandbyStatistic{ diff --git a/output/transform/postgres_statements.go b/output/transform/postgres_statements.go index ad3b83ee..4fb64b7a 100644 --- a/output/transform/postgres_statements.go +++ b/output/transform/postgres_statements.go @@ -3,10 +3,10 @@ package transform import ( "time" - "github.com/golang/protobuf/ptypes" snapshot "github.com/pganalyze/collector/output/pganalyze_collector" "github.com/pganalyze/collector/state" "github.com/pganalyze/collector/util" + "google.golang.org/protobuf/types/known/timestamppb" ) func groupStatements(statements state.PostgresStatementMap, statsMap state.DiffedPostgresStatementStatsMap) map[statementKey]statementValue { @@ -84,7 +84,7 @@ func transformPostgresStatements(s snapshot.FullSnapshot, newState state.Persist } h := snapshot.HistoricQueryStatistics{} - h.CollectedAt, _ = ptypes.TimestampProto(timeKey.CollectedAt) + h.CollectedAt = timestamppb.New(timeKey.CollectedAt) h.CollectedIntervalSecs = timeKey.CollectedIntervalSecs groupedStatements = groupStatements(transientState.Statements, diffedStats) diff --git a/output/transform/system.go b/output/transform/system.go index f3a78f3d..ad95735c 100644 --- a/output/transform/system.go +++ b/output/transform/system.go @@ -3,9 +3,9 @@ package transform import ( "sort" - "github.com/golang/protobuf/ptypes" snapshot "github.com/pganalyze/collector/output/pganalyze_collector" "github.com/pganalyze/collector/state" + "google.golang.org/protobuf/types/known/timestamppb" ) func SystemStateToCompactSystemSnapshot(systemState state.SystemState) snapshot.CompactSystemSnapshot { @@ -54,8 +54,8 @@ func transformSystem(systemState state.SystemState, diffState state.DiffState) * } else if systemState.Info.Type == state.AmazonRdsSystem { system.SystemInformation.Type = snapshot.SystemInformation_AMAZON_RDS_SYSTEM if systemState.Info.AmazonRds != nil { - latestRestorableTime, _ := ptypes.TimestampProto(systemState.Info.AmazonRds.LatestRestorableTime) - createdAt, _ := ptypes.TimestampProto(systemState.Info.AmazonRds.CreatedAt) + latestRestorableTime := timestamppb.New(systemState.Info.AmazonRds.LatestRestorableTime) + createdAt := timestamppb.New(systemState.Info.AmazonRds.CreatedAt) system.SystemInformation.Info = &snapshot.SystemInformation_AmazonRds{ AmazonRds: &snapshot.SystemInformationAmazonRDS{ diff --git a/protobuf b/protobuf index f629f94e..81e20d5a 160000 --- a/protobuf +++ b/protobuf @@ -1 +1 @@ -Subproject commit f629f94ed6683155f3b85ee1bb27a789615bb4c8 +Subproject commit 81e20d5aa95951a7f2108c871547203b9fdb1466 diff --git a/reports/bloat.go b/reports/bloat.go index 66b965d9..e7ecc1f0 100644 --- a/reports/bloat.go +++ b/reports/bloat.go @@ -4,11 +4,11 @@ import ( "database/sql" "time" - "github.com/golang/protobuf/ptypes" "github.com/pganalyze/collector/input/postgres" "github.com/pganalyze/collector/output/pganalyze_collector" "github.com/pganalyze/collector/state" "github.com/pganalyze/collector/util" + "google.golang.org/protobuf/types/known/timestamppb" ) // BloatReport - Report on table and index bloat @@ -47,7 +47,7 @@ func (report *BloatReport) Result() *pganalyze_collector.Report { r.ReportRunId = report.ReportRunID r.ReportType = "bloat" - r.CollectedAt, _ = ptypes.TimestampProto(report.CollectedAt) + r.CollectedAt = timestamppb.New(report.CollectedAt) data.DatabaseReferences = append(data.DatabaseReferences, &pganalyze_collector.DatabaseReference{Name: report.Data.DatabaseName}) diff --git a/reports/buffercache.go b/reports/buffercache.go index 81518032..301c9f1c 100644 --- a/reports/buffercache.go +++ b/reports/buffercache.go @@ -4,7 +4,7 @@ import ( "database/sql" "time" - "github.com/golang/protobuf/ptypes" + "google.golang.org/protobuf/types/known/timestamppb" "github.com/pganalyze/collector/input/postgres" "github.com/pganalyze/collector/output/pganalyze_collector" @@ -49,7 +49,7 @@ func (report *BuffercacheReport) Result() *pganalyze_collector.Report { r.ReportRunId = report.ReportRunID r.ReportType = "buffercache" - r.CollectedAt, _ = ptypes.TimestampProto(report.CollectedAt) + r.CollectedAt = timestamppb.New(report.CollectedAt) data.FreeBytes = report.Data.FreeBytes data.TotalBytes = report.Data.TotalBytes diff --git a/reports/sequence.go b/reports/sequence.go index f2046d22..6578a14a 100644 --- a/reports/sequence.go +++ b/reports/sequence.go @@ -4,11 +4,11 @@ import ( "database/sql" "time" - "github.com/golang/protobuf/ptypes" "github.com/pganalyze/collector/input/postgres" "github.com/pganalyze/collector/output/pganalyze_collector" "github.com/pganalyze/collector/state" "github.com/pganalyze/collector/util" + "google.golang.org/protobuf/types/known/timestamppb" ) // VacuumReport - Report on sequence statistics @@ -45,7 +45,7 @@ func (report *SequenceReport) Result() *pganalyze_collector.Report { r.ReportRunId = report.ReportRunID r.ReportType = report.ReportType() - r.CollectedAt, _ = ptypes.TimestampProto(report.CollectedAt) + r.CollectedAt = timestamppb.New(report.CollectedAt) data.DatabaseReferences = append(data.DatabaseReferences, &pganalyze_collector.DatabaseReference{Name: report.Data.DatabaseName}) diff --git a/reports/vacuum.go b/reports/vacuum.go index 02a06824..e7da756f 100644 --- a/reports/vacuum.go +++ b/reports/vacuum.go @@ -4,11 +4,11 @@ import ( "database/sql" "time" - "github.com/golang/protobuf/ptypes" "github.com/pganalyze/collector/input/postgres" "github.com/pganalyze/collector/output/pganalyze_collector" "github.com/pganalyze/collector/state" "github.com/pganalyze/collector/util" + "google.golang.org/protobuf/types/known/timestamppb" ) // VacuumReport - Report on table vacuum statistics @@ -45,7 +45,7 @@ func (report *VacuumReport) Result() *pganalyze_collector.Report { r.ReportRunId = report.ReportRunID r.ReportType = report.ReportType() - r.CollectedAt, _ = ptypes.TimestampProto(report.CollectedAt) + r.CollectedAt = timestamppb.New(report.CollectedAt) data.DatabaseReferences = append(data.DatabaseReferences, &pganalyze_collector.DatabaseReference{Name: report.Data.DatabaseName}) data.AutovacuumMaxWorkers = report.Data.AutovacuumMaxWorkers @@ -71,19 +71,19 @@ func (report *VacuumReport) Result() *pganalyze_collector.Report { } if relation.LastManualVacuumRun.Valid { - t, _ := ptypes.TimestampProto(relation.LastManualVacuumRun.Time) + t := timestamppb.New(relation.LastManualVacuumRun.Time) stats.LastManualVacuumRun = &pganalyze_collector.NullTimestamp{Valid: true, Value: t} } if relation.LastAutoVacuumRun.Valid { - t, _ := ptypes.TimestampProto(relation.LastAutoVacuumRun.Time) + t := timestamppb.New(relation.LastAutoVacuumRun.Time) stats.LastAutoVacuumRun = &pganalyze_collector.NullTimestamp{Valid: true, Value: t} } if relation.LastManualAnalyzeRun.Valid { - t, _ := ptypes.TimestampProto(relation.LastManualAnalyzeRun.Time) + t := timestamppb.New(relation.LastManualAnalyzeRun.Time) stats.LastManualAnalyzeRun = &pganalyze_collector.NullTimestamp{Valid: true, Value: t} } if relation.LastAutoAnalyzeRun.Valid { - t, _ := ptypes.TimestampProto(relation.LastAutoAnalyzeRun.Time) + t := timestamppb.New(relation.LastAutoAnalyzeRun.Time) stats.LastAutoAnalyzeRun = &pganalyze_collector.NullTimestamp{Valid: true, Value: t} } diff --git a/runner/reports.go b/runner/reports.go index a4402ce4..627b18c7 100644 --- a/runner/reports.go +++ b/runner/reports.go @@ -10,13 +10,12 @@ import ( "net/url" "strings" - "github.com/golang/protobuf/jsonpb" - "github.com/pganalyze/collector/input/postgres" "github.com/pganalyze/collector/output" "github.com/pganalyze/collector/reports" "github.com/pganalyze/collector/state" "github.com/pganalyze/collector/util" + "google.golang.org/protobuf/encoding/protojson" ) func runReport(reportType string, server *state.Server, globalCollectionOpts state.CollectionOpts, logger *util.Logger) (report reports.Report) { @@ -128,13 +127,12 @@ func RunTestReport(servers []*state.Server, globalCollectionOpts state.Collectio } var out bytes.Buffer - var marshaler jsonpb.Marshaler - dataJSON, err := marshaler.MarshalToString(report.Result()) + dataJSON, err := protojson.Marshal(report.Result()) if err != nil { logger.PrintError("Failed to transform protocol buffers to JSON: %s", err) return } - json.Indent(&out, []byte(dataJSON), "", "\t") + json.Indent(&out, dataJSON, "", "\t") fmt.Printf("%s\n", out.String()) } } diff --git a/tools.go b/tools.go index 4b6d18eb..81fd40ee 100644 --- a/tools.go +++ b/tools.go @@ -4,5 +4,5 @@ package tools import ( - _ "github.com/golang/protobuf/protoc-gen-go" + _ "google.golang.org/protobuf/cmd/protoc-gen-go" ) diff --git a/util/protobuf.go b/util/protobuf.go index b0d4608b..c0e189f5 100644 --- a/util/protobuf.go +++ b/util/protobuf.go @@ -4,11 +4,10 @@ import ( "fmt" "time" - "github.com/golang/protobuf/ptypes" - "github.com/golang/protobuf/ptypes/timestamp" + "google.golang.org/protobuf/types/known/timestamppb" ) -type Timestamp timestamp.Timestamp +type Timestamp timestamppb.Timestamp func (ts *Timestamp) Scan(value interface{}) error { if ts != nil { @@ -16,16 +15,13 @@ func (ts *Timestamp) Scan(value interface{}) error { } var t time.Time - var protoTs *timestamp.Timestamp + var protoTs *timestamppb.Timestamp if value == nil { return nil } t = value.(time.Time) - protoTs, err := ptypes.TimestampProto(t) - if err != nil { - return err - } + protoTs = timestamppb.New(t) *ts = Timestamp(*protoTs) diff --git a/vendor/github.com/golang/protobuf/jsonpb/decode.go b/vendor/github.com/golang/protobuf/jsonpb/decode.go deleted file mode 100644 index 7c6c5a52..00000000 --- a/vendor/github.com/golang/protobuf/jsonpb/decode.go +++ /dev/null @@ -1,514 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package jsonpb - -import ( - "encoding/json" - "errors" - "fmt" - "io" - "math" - "reflect" - "strconv" - "strings" - "time" - - "github.com/golang/protobuf/proto" - "google.golang.org/protobuf/encoding/protojson" - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -const wrapJSONUnmarshalV2 = false - -// UnmarshalNext unmarshals the next JSON object from d into m. -func UnmarshalNext(d *json.Decoder, m proto.Message) error { - return new(Unmarshaler).UnmarshalNext(d, m) -} - -// Unmarshal unmarshals a JSON object from r into m. -func Unmarshal(r io.Reader, m proto.Message) error { - return new(Unmarshaler).Unmarshal(r, m) -} - -// UnmarshalString unmarshals a JSON object from s into m. -func UnmarshalString(s string, m proto.Message) error { - return new(Unmarshaler).Unmarshal(strings.NewReader(s), m) -} - -// Unmarshaler is a configurable object for converting from a JSON -// representation to a protocol buffer object. -type Unmarshaler struct { - // AllowUnknownFields specifies whether to allow messages to contain - // unknown JSON fields, as opposed to failing to unmarshal. - AllowUnknownFields bool - - // AnyResolver is used to resolve the google.protobuf.Any well-known type. - // If unset, the global registry is used by default. - AnyResolver AnyResolver -} - -// JSONPBUnmarshaler is implemented by protobuf messages that customize the way -// they are unmarshaled from JSON. Messages that implement this should also -// implement JSONPBMarshaler so that the custom format can be produced. -// -// The JSON unmarshaling must follow the JSON to proto specification: -// https://developers.google.com/protocol-buffers/docs/proto3#json -// -// Deprecated: Custom types should implement protobuf reflection instead. -type JSONPBUnmarshaler interface { - UnmarshalJSONPB(*Unmarshaler, []byte) error -} - -// Unmarshal unmarshals a JSON object from r into m. -func (u *Unmarshaler) Unmarshal(r io.Reader, m proto.Message) error { - return u.UnmarshalNext(json.NewDecoder(r), m) -} - -// UnmarshalNext unmarshals the next JSON object from d into m. -func (u *Unmarshaler) UnmarshalNext(d *json.Decoder, m proto.Message) error { - if m == nil { - return errors.New("invalid nil message") - } - - // Parse the next JSON object from the stream. - raw := json.RawMessage{} - if err := d.Decode(&raw); err != nil { - return err - } - - // Check for custom unmarshalers first since they may not properly - // implement protobuf reflection that the logic below relies on. - if jsu, ok := m.(JSONPBUnmarshaler); ok { - return jsu.UnmarshalJSONPB(u, raw) - } - - mr := proto.MessageReflect(m) - - // NOTE: For historical reasons, a top-level null is treated as a noop. - // This is incorrect, but kept for compatibility. - if string(raw) == "null" && mr.Descriptor().FullName() != "google.protobuf.Value" { - return nil - } - - if wrapJSONUnmarshalV2 { - // NOTE: If input message is non-empty, we need to preserve merge semantics - // of the old jsonpb implementation. These semantics are not supported by - // the protobuf JSON specification. - isEmpty := true - mr.Range(func(protoreflect.FieldDescriptor, protoreflect.Value) bool { - isEmpty = false // at least one iteration implies non-empty - return false - }) - if !isEmpty { - // Perform unmarshaling into a newly allocated, empty message. - mr = mr.New() - - // Use a defer to copy all unmarshaled fields into the original message. - dst := proto.MessageReflect(m) - defer mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - dst.Set(fd, v) - return true - }) - } - - // Unmarshal using the v2 JSON unmarshaler. - opts := protojson.UnmarshalOptions{ - DiscardUnknown: u.AllowUnknownFields, - } - if u.AnyResolver != nil { - opts.Resolver = anyResolver{u.AnyResolver} - } - return opts.Unmarshal(raw, mr.Interface()) - } else { - if err := u.unmarshalMessage(mr, raw); err != nil { - return err - } - return protoV2.CheckInitialized(mr.Interface()) - } -} - -func (u *Unmarshaler) unmarshalMessage(m protoreflect.Message, in []byte) error { - md := m.Descriptor() - fds := md.Fields() - - if string(in) == "null" && md.FullName() != "google.protobuf.Value" { - return nil - } - - if jsu, ok := proto.MessageV1(m.Interface()).(JSONPBUnmarshaler); ok { - return jsu.UnmarshalJSONPB(u, in) - } - - switch wellKnownType(md.FullName()) { - case "Any": - var jsonObject map[string]json.RawMessage - if err := json.Unmarshal(in, &jsonObject); err != nil { - return err - } - - rawTypeURL, ok := jsonObject["@type"] - if !ok { - return errors.New("Any JSON doesn't have '@type'") - } - typeURL, err := unquoteString(string(rawTypeURL)) - if err != nil { - return fmt.Errorf("can't unmarshal Any's '@type': %q", rawTypeURL) - } - m.Set(fds.ByNumber(1), protoreflect.ValueOfString(typeURL)) - - var m2 protoreflect.Message - if u.AnyResolver != nil { - mi, err := u.AnyResolver.Resolve(typeURL) - if err != nil { - return err - } - m2 = proto.MessageReflect(mi) - } else { - mt, err := protoregistry.GlobalTypes.FindMessageByURL(typeURL) - if err != nil { - if err == protoregistry.NotFound { - return fmt.Errorf("could not resolve Any message type: %v", typeURL) - } - return err - } - m2 = mt.New() - } - - if wellKnownType(m2.Descriptor().FullName()) != "" { - rawValue, ok := jsonObject["value"] - if !ok { - return errors.New("Any JSON doesn't have 'value'") - } - if err := u.unmarshalMessage(m2, rawValue); err != nil { - return fmt.Errorf("can't unmarshal Any nested proto %v: %v", typeURL, err) - } - } else { - delete(jsonObject, "@type") - rawJSON, err := json.Marshal(jsonObject) - if err != nil { - return fmt.Errorf("can't generate JSON for Any's nested proto to be unmarshaled: %v", err) - } - if err = u.unmarshalMessage(m2, rawJSON); err != nil { - return fmt.Errorf("can't unmarshal Any nested proto %v: %v", typeURL, err) - } - } - - rawWire, err := protoV2.Marshal(m2.Interface()) - if err != nil { - return fmt.Errorf("can't marshal proto %v into Any.Value: %v", typeURL, err) - } - m.Set(fds.ByNumber(2), protoreflect.ValueOfBytes(rawWire)) - return nil - case "BoolValue", "BytesValue", "StringValue", - "Int32Value", "UInt32Value", "FloatValue", - "Int64Value", "UInt64Value", "DoubleValue": - fd := fds.ByNumber(1) - v, err := u.unmarshalValue(m.NewField(fd), in, fd) - if err != nil { - return err - } - m.Set(fd, v) - return nil - case "Duration": - v, err := unquoteString(string(in)) - if err != nil { - return err - } - d, err := time.ParseDuration(v) - if err != nil { - return fmt.Errorf("bad Duration: %v", err) - } - - sec := d.Nanoseconds() / 1e9 - nsec := d.Nanoseconds() % 1e9 - m.Set(fds.ByNumber(1), protoreflect.ValueOfInt64(int64(sec))) - m.Set(fds.ByNumber(2), protoreflect.ValueOfInt32(int32(nsec))) - return nil - case "Timestamp": - v, err := unquoteString(string(in)) - if err != nil { - return err - } - t, err := time.Parse(time.RFC3339Nano, v) - if err != nil { - return fmt.Errorf("bad Timestamp: %v", err) - } - - sec := t.Unix() - nsec := t.Nanosecond() - m.Set(fds.ByNumber(1), protoreflect.ValueOfInt64(int64(sec))) - m.Set(fds.ByNumber(2), protoreflect.ValueOfInt32(int32(nsec))) - return nil - case "Value": - switch { - case string(in) == "null": - m.Set(fds.ByNumber(1), protoreflect.ValueOfEnum(0)) - case string(in) == "true": - m.Set(fds.ByNumber(4), protoreflect.ValueOfBool(true)) - case string(in) == "false": - m.Set(fds.ByNumber(4), protoreflect.ValueOfBool(false)) - case hasPrefixAndSuffix('"', in, '"'): - s, err := unquoteString(string(in)) - if err != nil { - return fmt.Errorf("unrecognized type for Value %q", in) - } - m.Set(fds.ByNumber(3), protoreflect.ValueOfString(s)) - case hasPrefixAndSuffix('[', in, ']'): - v := m.Mutable(fds.ByNumber(6)) - return u.unmarshalMessage(v.Message(), in) - case hasPrefixAndSuffix('{', in, '}'): - v := m.Mutable(fds.ByNumber(5)) - return u.unmarshalMessage(v.Message(), in) - default: - f, err := strconv.ParseFloat(string(in), 0) - if err != nil { - return fmt.Errorf("unrecognized type for Value %q", in) - } - m.Set(fds.ByNumber(2), protoreflect.ValueOfFloat64(f)) - } - return nil - case "ListValue": - var jsonArray []json.RawMessage - if err := json.Unmarshal(in, &jsonArray); err != nil { - return fmt.Errorf("bad ListValue: %v", err) - } - - lv := m.Mutable(fds.ByNumber(1)).List() - for _, raw := range jsonArray { - ve := lv.NewElement() - if err := u.unmarshalMessage(ve.Message(), raw); err != nil { - return err - } - lv.Append(ve) - } - return nil - case "Struct": - var jsonObject map[string]json.RawMessage - if err := json.Unmarshal(in, &jsonObject); err != nil { - return fmt.Errorf("bad StructValue: %v", err) - } - - mv := m.Mutable(fds.ByNumber(1)).Map() - for key, raw := range jsonObject { - kv := protoreflect.ValueOf(key).MapKey() - vv := mv.NewValue() - if err := u.unmarshalMessage(vv.Message(), raw); err != nil { - return fmt.Errorf("bad value in StructValue for key %q: %v", key, err) - } - mv.Set(kv, vv) - } - return nil - } - - var jsonObject map[string]json.RawMessage - if err := json.Unmarshal(in, &jsonObject); err != nil { - return err - } - - // Handle known fields. - for i := 0; i < fds.Len(); i++ { - fd := fds.Get(i) - if fd.IsWeak() && fd.Message().IsPlaceholder() { - continue // weak reference is not linked in - } - - // Search for any raw JSON value associated with this field. - var raw json.RawMessage - name := string(fd.Name()) - if fd.Kind() == protoreflect.GroupKind { - name = string(fd.Message().Name()) - } - if v, ok := jsonObject[name]; ok { - delete(jsonObject, name) - raw = v - } - name = string(fd.JSONName()) - if v, ok := jsonObject[name]; ok { - delete(jsonObject, name) - raw = v - } - - // Unmarshal the field value. - if raw == nil || (string(raw) == "null" && !isSingularWellKnownValue(fd)) { - continue - } - v, err := u.unmarshalValue(m.NewField(fd), raw, fd) - if err != nil { - return err - } - m.Set(fd, v) - } - - // Handle extension fields. - for name, raw := range jsonObject { - if !strings.HasPrefix(name, "[") || !strings.HasSuffix(name, "]") { - continue - } - - // Resolve the extension field by name. - xname := protoreflect.FullName(name[len("[") : len(name)-len("]")]) - xt, _ := protoregistry.GlobalTypes.FindExtensionByName(xname) - if xt == nil && isMessageSet(md) { - xt, _ = protoregistry.GlobalTypes.FindExtensionByName(xname.Append("message_set_extension")) - } - if xt == nil { - continue - } - delete(jsonObject, name) - fd := xt.TypeDescriptor() - if fd.ContainingMessage().FullName() != m.Descriptor().FullName() { - return fmt.Errorf("extension field %q does not extend message %q", xname, m.Descriptor().FullName()) - } - - // Unmarshal the field value. - if raw == nil || (string(raw) == "null" && !isSingularWellKnownValue(fd)) { - continue - } - v, err := u.unmarshalValue(m.NewField(fd), raw, fd) - if err != nil { - return err - } - m.Set(fd, v) - } - - if !u.AllowUnknownFields && len(jsonObject) > 0 { - for name := range jsonObject { - return fmt.Errorf("unknown field %q in %v", name, md.FullName()) - } - } - return nil -} - -func isSingularWellKnownValue(fd protoreflect.FieldDescriptor) bool { - if md := fd.Message(); md != nil { - return md.FullName() == "google.protobuf.Value" && fd.Cardinality() != protoreflect.Repeated - } - return false -} - -func (u *Unmarshaler) unmarshalValue(v protoreflect.Value, in []byte, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { - switch { - case fd.IsList(): - var jsonArray []json.RawMessage - if err := json.Unmarshal(in, &jsonArray); err != nil { - return v, err - } - lv := v.List() - for _, raw := range jsonArray { - ve, err := u.unmarshalSingularValue(lv.NewElement(), raw, fd) - if err != nil { - return v, err - } - lv.Append(ve) - } - return v, nil - case fd.IsMap(): - var jsonObject map[string]json.RawMessage - if err := json.Unmarshal(in, &jsonObject); err != nil { - return v, err - } - kfd := fd.MapKey() - vfd := fd.MapValue() - mv := v.Map() - for key, raw := range jsonObject { - var kv protoreflect.MapKey - if kfd.Kind() == protoreflect.StringKind { - kv = protoreflect.ValueOf(key).MapKey() - } else { - v, err := u.unmarshalSingularValue(kfd.Default(), []byte(key), kfd) - if err != nil { - return v, err - } - kv = v.MapKey() - } - - vv, err := u.unmarshalSingularValue(mv.NewValue(), raw, vfd) - if err != nil { - return v, err - } - mv.Set(kv, vv) - } - return v, nil - default: - return u.unmarshalSingularValue(v, in, fd) - } -} - -var nonFinite = map[string]float64{ - `"NaN"`: math.NaN(), - `"Infinity"`: math.Inf(+1), - `"-Infinity"`: math.Inf(-1), -} - -func (u *Unmarshaler) unmarshalSingularValue(v protoreflect.Value, in []byte, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { - switch fd.Kind() { - case protoreflect.BoolKind: - return unmarshalValue(in, new(bool)) - case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: - return unmarshalValue(trimQuote(in), new(int32)) - case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: - return unmarshalValue(trimQuote(in), new(int64)) - case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: - return unmarshalValue(trimQuote(in), new(uint32)) - case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: - return unmarshalValue(trimQuote(in), new(uint64)) - case protoreflect.FloatKind: - if f, ok := nonFinite[string(in)]; ok { - return protoreflect.ValueOfFloat32(float32(f)), nil - } - return unmarshalValue(trimQuote(in), new(float32)) - case protoreflect.DoubleKind: - if f, ok := nonFinite[string(in)]; ok { - return protoreflect.ValueOfFloat64(float64(f)), nil - } - return unmarshalValue(trimQuote(in), new(float64)) - case protoreflect.StringKind: - return unmarshalValue(in, new(string)) - case protoreflect.BytesKind: - return unmarshalValue(in, new([]byte)) - case protoreflect.EnumKind: - if hasPrefixAndSuffix('"', in, '"') { - vd := fd.Enum().Values().ByName(protoreflect.Name(trimQuote(in))) - if vd == nil { - return v, fmt.Errorf("unknown value %q for enum %s", in, fd.Enum().FullName()) - } - return protoreflect.ValueOfEnum(vd.Number()), nil - } - return unmarshalValue(in, new(protoreflect.EnumNumber)) - case protoreflect.MessageKind, protoreflect.GroupKind: - err := u.unmarshalMessage(v.Message(), in) - return v, err - default: - panic(fmt.Sprintf("invalid kind %v", fd.Kind())) - } -} - -func unmarshalValue(in []byte, v interface{}) (protoreflect.Value, error) { - err := json.Unmarshal(in, v) - return protoreflect.ValueOf(reflect.ValueOf(v).Elem().Interface()), err -} - -func unquoteString(in string) (out string, err error) { - err = json.Unmarshal([]byte(in), &out) - return out, err -} - -func hasPrefixAndSuffix(prefix byte, in []byte, suffix byte) bool { - if len(in) >= 2 && in[0] == prefix && in[len(in)-1] == suffix { - return true - } - return false -} - -// trimQuote is like unquoteString but simply strips surrounding quotes. -// This is incorrect, but is behavior done by the legacy implementation. -func trimQuote(in []byte) []byte { - if len(in) >= 2 && in[0] == '"' && in[len(in)-1] == '"' { - in = in[1 : len(in)-1] - } - return in -} diff --git a/vendor/github.com/golang/protobuf/jsonpb/encode.go b/vendor/github.com/golang/protobuf/jsonpb/encode.go deleted file mode 100644 index 7633019f..00000000 --- a/vendor/github.com/golang/protobuf/jsonpb/encode.go +++ /dev/null @@ -1,554 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package jsonpb - -import ( - "encoding/json" - "errors" - "fmt" - "io" - "math" - "reflect" - "sort" - "strconv" - "strings" - "time" - - "github.com/golang/protobuf/proto" - "google.golang.org/protobuf/encoding/protojson" - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -const wrapJSONMarshalV2 = false - -// Marshaler is a configurable object for marshaling protocol buffer messages -// to the specified JSON representation. -type Marshaler struct { - // OrigName specifies whether to use the original protobuf name for fields. - OrigName bool - - // EnumsAsInts specifies whether to render enum values as integers, - // as opposed to string values. - EnumsAsInts bool - - // EmitDefaults specifies whether to render fields with zero values. - EmitDefaults bool - - // Indent controls whether the output is compact or not. - // If empty, the output is compact JSON. Otherwise, every JSON object - // entry and JSON array value will be on its own line. - // Each line will be preceded by repeated copies of Indent, where the - // number of copies is the current indentation depth. - Indent string - - // AnyResolver is used to resolve the google.protobuf.Any well-known type. - // If unset, the global registry is used by default. - AnyResolver AnyResolver -} - -// JSONPBMarshaler is implemented by protobuf messages that customize the -// way they are marshaled to JSON. Messages that implement this should also -// implement JSONPBUnmarshaler so that the custom format can be parsed. -// -// The JSON marshaling must follow the proto to JSON specification: -// https://developers.google.com/protocol-buffers/docs/proto3#json -// -// Deprecated: Custom types should implement protobuf reflection instead. -type JSONPBMarshaler interface { - MarshalJSONPB(*Marshaler) ([]byte, error) -} - -// Marshal serializes a protobuf message as JSON into w. -func (jm *Marshaler) Marshal(w io.Writer, m proto.Message) error { - b, err := jm.marshal(m) - if len(b) > 0 { - if _, err := w.Write(b); err != nil { - return err - } - } - return err -} - -// MarshalToString serializes a protobuf message as JSON in string form. -func (jm *Marshaler) MarshalToString(m proto.Message) (string, error) { - b, err := jm.marshal(m) - if err != nil { - return "", err - } - return string(b), nil -} - -func (jm *Marshaler) marshal(m proto.Message) ([]byte, error) { - v := reflect.ValueOf(m) - if m == nil || (v.Kind() == reflect.Ptr && v.IsNil()) { - return nil, errors.New("Marshal called with nil") - } - - // Check for custom marshalers first since they may not properly - // implement protobuf reflection that the logic below relies on. - if jsm, ok := m.(JSONPBMarshaler); ok { - return jsm.MarshalJSONPB(jm) - } - - if wrapJSONMarshalV2 { - opts := protojson.MarshalOptions{ - UseProtoNames: jm.OrigName, - UseEnumNumbers: jm.EnumsAsInts, - EmitUnpopulated: jm.EmitDefaults, - Indent: jm.Indent, - } - if jm.AnyResolver != nil { - opts.Resolver = anyResolver{jm.AnyResolver} - } - return opts.Marshal(proto.MessageReflect(m).Interface()) - } else { - // Check for unpopulated required fields first. - m2 := proto.MessageReflect(m) - if err := protoV2.CheckInitialized(m2.Interface()); err != nil { - return nil, err - } - - w := jsonWriter{Marshaler: jm} - err := w.marshalMessage(m2, "", "") - return w.buf, err - } -} - -type jsonWriter struct { - *Marshaler - buf []byte -} - -func (w *jsonWriter) write(s string) { - w.buf = append(w.buf, s...) -} - -func (w *jsonWriter) marshalMessage(m protoreflect.Message, indent, typeURL string) error { - if jsm, ok := proto.MessageV1(m.Interface()).(JSONPBMarshaler); ok { - b, err := jsm.MarshalJSONPB(w.Marshaler) - if err != nil { - return err - } - if typeURL != "" { - // we are marshaling this object to an Any type - var js map[string]*json.RawMessage - if err = json.Unmarshal(b, &js); err != nil { - return fmt.Errorf("type %T produced invalid JSON: %v", m.Interface(), err) - } - turl, err := json.Marshal(typeURL) - if err != nil { - return fmt.Errorf("failed to marshal type URL %q to JSON: %v", typeURL, err) - } - js["@type"] = (*json.RawMessage)(&turl) - if b, err = json.Marshal(js); err != nil { - return err - } - } - w.write(string(b)) - return nil - } - - md := m.Descriptor() - fds := md.Fields() - - // Handle well-known types. - const secondInNanos = int64(time.Second / time.Nanosecond) - switch wellKnownType(md.FullName()) { - case "Any": - return w.marshalAny(m, indent) - case "BoolValue", "BytesValue", "StringValue", - "Int32Value", "UInt32Value", "FloatValue", - "Int64Value", "UInt64Value", "DoubleValue": - fd := fds.ByNumber(1) - return w.marshalValue(fd, m.Get(fd), indent) - case "Duration": - // "Generated output always contains 0, 3, 6, or 9 fractional digits, - // depending on required precision." - s := m.Get(fds.ByNumber(1)).Int() - ns := m.Get(fds.ByNumber(2)).Int() - if ns <= -secondInNanos || ns >= secondInNanos { - return fmt.Errorf("ns out of range (%v, %v)", -secondInNanos, secondInNanos) - } - if (s > 0 && ns < 0) || (s < 0 && ns > 0) { - return errors.New("signs of seconds and nanos do not match") - } - if s < 0 { - ns = -ns - } - x := fmt.Sprintf("%d.%09d", s, ns) - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, ".000") - w.write(fmt.Sprintf(`"%vs"`, x)) - return nil - case "Timestamp": - // "RFC 3339, where generated output will always be Z-normalized - // and uses 0, 3, 6 or 9 fractional digits." - s := m.Get(fds.ByNumber(1)).Int() - ns := m.Get(fds.ByNumber(2)).Int() - if ns < 0 || ns >= secondInNanos { - return fmt.Errorf("ns out of range [0, %v)", secondInNanos) - } - t := time.Unix(s, ns).UTC() - // time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits). - x := t.Format("2006-01-02T15:04:05.000000000") - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, ".000") - w.write(fmt.Sprintf(`"%vZ"`, x)) - return nil - case "Value": - // JSON value; which is a null, number, string, bool, object, or array. - od := md.Oneofs().Get(0) - fd := m.WhichOneof(od) - if fd == nil { - return errors.New("nil Value") - } - return w.marshalValue(fd, m.Get(fd), indent) - case "Struct", "ListValue": - // JSON object or array. - fd := fds.ByNumber(1) - return w.marshalValue(fd, m.Get(fd), indent) - } - - w.write("{") - if w.Indent != "" { - w.write("\n") - } - - firstField := true - if typeURL != "" { - if err := w.marshalTypeURL(indent, typeURL); err != nil { - return err - } - firstField = false - } - - for i := 0; i < fds.Len(); { - fd := fds.Get(i) - if od := fd.ContainingOneof(); od != nil { - fd = m.WhichOneof(od) - i += od.Fields().Len() - if fd == nil { - continue - } - } else { - i++ - } - - v := m.Get(fd) - - if !m.Has(fd) { - if !w.EmitDefaults || fd.ContainingOneof() != nil { - continue - } - if fd.Cardinality() != protoreflect.Repeated && (fd.Message() != nil || fd.Syntax() == protoreflect.Proto2) { - v = protoreflect.Value{} // use "null" for singular messages or proto2 scalars - } - } - - if !firstField { - w.writeComma() - } - if err := w.marshalField(fd, v, indent); err != nil { - return err - } - firstField = false - } - - // Handle proto2 extensions. - if md.ExtensionRanges().Len() > 0 { - // Collect a sorted list of all extension descriptor and values. - type ext struct { - desc protoreflect.FieldDescriptor - val protoreflect.Value - } - var exts []ext - m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - if fd.IsExtension() { - exts = append(exts, ext{fd, v}) - } - return true - }) - sort.Slice(exts, func(i, j int) bool { - return exts[i].desc.Number() < exts[j].desc.Number() - }) - - for _, ext := range exts { - if !firstField { - w.writeComma() - } - if err := w.marshalField(ext.desc, ext.val, indent); err != nil { - return err - } - firstField = false - } - } - - if w.Indent != "" { - w.write("\n") - w.write(indent) - } - w.write("}") - return nil -} - -func (w *jsonWriter) writeComma() { - if w.Indent != "" { - w.write(",\n") - } else { - w.write(",") - } -} - -func (w *jsonWriter) marshalAny(m protoreflect.Message, indent string) error { - // "If the Any contains a value that has a special JSON mapping, - // it will be converted as follows: {"@type": xxx, "value": yyy}. - // Otherwise, the value will be converted into a JSON object, - // and the "@type" field will be inserted to indicate the actual data type." - md := m.Descriptor() - typeURL := m.Get(md.Fields().ByNumber(1)).String() - rawVal := m.Get(md.Fields().ByNumber(2)).Bytes() - - var m2 protoreflect.Message - if w.AnyResolver != nil { - mi, err := w.AnyResolver.Resolve(typeURL) - if err != nil { - return err - } - m2 = proto.MessageReflect(mi) - } else { - mt, err := protoregistry.GlobalTypes.FindMessageByURL(typeURL) - if err != nil { - return err - } - m2 = mt.New() - } - - if err := protoV2.Unmarshal(rawVal, m2.Interface()); err != nil { - return err - } - - if wellKnownType(m2.Descriptor().FullName()) == "" { - return w.marshalMessage(m2, indent, typeURL) - } - - w.write("{") - if w.Indent != "" { - w.write("\n") - } - if err := w.marshalTypeURL(indent, typeURL); err != nil { - return err - } - w.writeComma() - if w.Indent != "" { - w.write(indent) - w.write(w.Indent) - w.write(`"value": `) - } else { - w.write(`"value":`) - } - if err := w.marshalMessage(m2, indent+w.Indent, ""); err != nil { - return err - } - if w.Indent != "" { - w.write("\n") - w.write(indent) - } - w.write("}") - return nil -} - -func (w *jsonWriter) marshalTypeURL(indent, typeURL string) error { - if w.Indent != "" { - w.write(indent) - w.write(w.Indent) - } - w.write(`"@type":`) - if w.Indent != "" { - w.write(" ") - } - b, err := json.Marshal(typeURL) - if err != nil { - return err - } - w.write(string(b)) - return nil -} - -// marshalField writes field description and value to the Writer. -func (w *jsonWriter) marshalField(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error { - if w.Indent != "" { - w.write(indent) - w.write(w.Indent) - } - w.write(`"`) - switch { - case fd.IsExtension(): - // For message set, use the fname of the message as the extension name. - name := string(fd.FullName()) - if isMessageSet(fd.ContainingMessage()) { - name = strings.TrimSuffix(name, ".message_set_extension") - } - - w.write("[" + name + "]") - case w.OrigName: - name := string(fd.Name()) - if fd.Kind() == protoreflect.GroupKind { - name = string(fd.Message().Name()) - } - w.write(name) - default: - w.write(string(fd.JSONName())) - } - w.write(`":`) - if w.Indent != "" { - w.write(" ") - } - return w.marshalValue(fd, v, indent) -} - -func (w *jsonWriter) marshalValue(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error { - switch { - case fd.IsList(): - w.write("[") - comma := "" - lv := v.List() - for i := 0; i < lv.Len(); i++ { - w.write(comma) - if w.Indent != "" { - w.write("\n") - w.write(indent) - w.write(w.Indent) - w.write(w.Indent) - } - if err := w.marshalSingularValue(fd, lv.Get(i), indent+w.Indent); err != nil { - return err - } - comma = "," - } - if w.Indent != "" { - w.write("\n") - w.write(indent) - w.write(w.Indent) - } - w.write("]") - return nil - case fd.IsMap(): - kfd := fd.MapKey() - vfd := fd.MapValue() - mv := v.Map() - - // Collect a sorted list of all map keys and values. - type entry struct{ key, val protoreflect.Value } - var entries []entry - mv.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool { - entries = append(entries, entry{k.Value(), v}) - return true - }) - sort.Slice(entries, func(i, j int) bool { - switch kfd.Kind() { - case protoreflect.BoolKind: - return !entries[i].key.Bool() && entries[j].key.Bool() - case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: - return entries[i].key.Int() < entries[j].key.Int() - case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, protoreflect.Fixed64Kind: - return entries[i].key.Uint() < entries[j].key.Uint() - case protoreflect.StringKind: - return entries[i].key.String() < entries[j].key.String() - default: - panic("invalid kind") - } - }) - - w.write(`{`) - comma := "" - for _, entry := range entries { - w.write(comma) - if w.Indent != "" { - w.write("\n") - w.write(indent) - w.write(w.Indent) - w.write(w.Indent) - } - - s := fmt.Sprint(entry.key.Interface()) - b, err := json.Marshal(s) - if err != nil { - return err - } - w.write(string(b)) - - w.write(`:`) - if w.Indent != "" { - w.write(` `) - } - - if err := w.marshalSingularValue(vfd, entry.val, indent+w.Indent); err != nil { - return err - } - comma = "," - } - if w.Indent != "" { - w.write("\n") - w.write(indent) - w.write(w.Indent) - } - w.write(`}`) - return nil - default: - return w.marshalSingularValue(fd, v, indent) - } -} - -func (w *jsonWriter) marshalSingularValue(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error { - switch { - case !v.IsValid(): - w.write("null") - return nil - case fd.Message() != nil: - return w.marshalMessage(v.Message(), indent+w.Indent, "") - case fd.Enum() != nil: - if fd.Enum().FullName() == "google.protobuf.NullValue" { - w.write("null") - return nil - } - - vd := fd.Enum().Values().ByNumber(v.Enum()) - if vd == nil || w.EnumsAsInts { - w.write(strconv.Itoa(int(v.Enum()))) - } else { - w.write(`"` + string(vd.Name()) + `"`) - } - return nil - default: - switch v.Interface().(type) { - case float32, float64: - switch { - case math.IsInf(v.Float(), +1): - w.write(`"Infinity"`) - return nil - case math.IsInf(v.Float(), -1): - w.write(`"-Infinity"`) - return nil - case math.IsNaN(v.Float()): - w.write(`"NaN"`) - return nil - } - case int64, uint64: - w.write(fmt.Sprintf(`"%d"`, v.Interface())) - return nil - } - - b, err := json.Marshal(v.Interface()) - if err != nil { - return err - } - w.write(string(b)) - return nil - } -} diff --git a/vendor/github.com/golang/protobuf/jsonpb/json.go b/vendor/github.com/golang/protobuf/jsonpb/json.go deleted file mode 100644 index 480e2448..00000000 --- a/vendor/github.com/golang/protobuf/jsonpb/json.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package jsonpb provides functionality to marshal and unmarshal between a -// protocol buffer message and JSON. It follows the specification at -// https://developers.google.com/protocol-buffers/docs/proto3#json. -// -// Do not rely on the default behavior of the standard encoding/json package -// when called on generated message types as it does not operate correctly. -// -// Deprecated: Use the "google.golang.org/protobuf/encoding/protojson" -// package instead. -package jsonpb - -import ( - "github.com/golang/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoimpl" -) - -// AnyResolver takes a type URL, present in an Any message, -// and resolves it into an instance of the associated message. -type AnyResolver interface { - Resolve(typeURL string) (proto.Message, error) -} - -type anyResolver struct{ AnyResolver } - -func (r anyResolver) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) { - return r.FindMessageByURL(string(message)) -} - -func (r anyResolver) FindMessageByURL(url string) (protoreflect.MessageType, error) { - m, err := r.Resolve(url) - if err != nil { - return nil, err - } - return protoimpl.X.MessageTypeOf(m), nil -} - -func (r anyResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) { - return protoregistry.GlobalTypes.FindExtensionByName(field) -} - -func (r anyResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { - return protoregistry.GlobalTypes.FindExtensionByNumber(message, field) -} - -func wellKnownType(s protoreflect.FullName) string { - if s.Parent() == "google.protobuf" { - switch s.Name() { - case "Empty", "Any", - "BoolValue", "BytesValue", "StringValue", - "Int32Value", "UInt32Value", "FloatValue", - "Int64Value", "UInt64Value", "DoubleValue", - "Duration", "Timestamp", - "NullValue", "Struct", "Value", "ListValue": - return string(s.Name()) - } - } - return "" -} - -func isMessageSet(md protoreflect.MessageDescriptor) bool { - ms, ok := md.(interface{ IsMessageSet() bool }) - return ok && ms.IsMessageSet() -} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/main.go b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/main.go new file mode 100644 index 00000000..a354df90 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/main.go @@ -0,0 +1,52 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// The protoc-gen-go binary is a protoc plugin to generate Go code for +// both proto2 and proto3 versions of the protocol buffer language. +// +// For more information about the usage of this plugin, see: +// https://developers.google.com/protocol-buffers/docs/reference/go-generated +package main + +import ( + "errors" + "flag" + "fmt" + "os" + "path/filepath" + + gengo "google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo" + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/internal/version" +) + +func main() { + if len(os.Args) == 2 && os.Args[1] == "--version" { + fmt.Fprintf(os.Stderr, "%v %v\n", filepath.Base(os.Args[0]), version.String()) + os.Exit(0) + } + + var ( + flags flag.FlagSet + plugins = flags.String("plugins", "", "deprecated option") + importPrefix = flags.String("import_prefix", "", "deprecated option") + ) + protogen.Options{ + ParamFunc: flags.Set, + }.Run(func(gen *protogen.Plugin) error { + if *plugins != "" { + return errors.New("protoc-gen-go: plugins are not supported; use 'protoc --go-grpc_out=...' to generate gRPC") + } + if *importPrefix != "" { + return errors.New("protoc-gen-go: import_prefix is not supported") + } + for _, f := range gen.Files { + if f.Generate { + gengo.GenerateFile(gen, f) + } + } + gen.SupportedFeatures = gengo.SupportedFeatures + return nil + }) +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/annotations/annotations.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/annotations/annotations.proto new file mode 100644 index 00000000..acd7b866 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/annotations/annotations.proto @@ -0,0 +1,17 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package goproto.protoc.annotations; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/annotations"; + +message AnnotationsTestMessage { + optional string AnnotationsTestField = 1; +} + +enum AnnotationsTestEnum { + ANNOTATIONS_TEST_ENUM_VALUE = 0; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/comments/comments.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/comments/comments.proto new file mode 100644 index 00000000..02998ce3 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/comments/comments.proto @@ -0,0 +1,61 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +// COMMENT: package goproto.protoc.comments; +package goproto.protoc.comments; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/comments"; + +// COMMENT: Enum1.Leading +enum Enum1 { + // COMMENT: FOO.Leading + FOO = 0; // COMMENT: FOO.InlineTrailing + // COMMENT: BAR.Leading + BAR = 1; + // COMMENT: BAR.Trailing1 + // COMMENT: BAR.Trailing2 + + // COMMENT: Enum1.EndBody +} + +// COMMENT: Message1.Leading +message Message1 { + // COMMENT: Message1A.Leading + message Message1A { + } // COMMENT: Message1A.Trailing + + // COMMENT: Message1B + message Message1B { + } + + // COMMENT: Field1A.Leading + optional string Field1A = 1; // COMMENT: Field1A.Trailing + + // COMMENT: Oneof1A.Leading + oneof Oneof1a { + // COMMENT: Oneof1AField1.Leading + string Oneof1AField1 = 2; // COMMENT: Oneof1AField1.Trailing + } // COMMENT: Oneof1A.Trailing + + extensions 100 to max; +} // COMMENT: Message1.Trailing + +// COMMENT: Extend +extend Message1 { + // COMMENT: Extension.Leading + optional Message1 extension = 100; // COMMENT: Extension.Trailing +} + +// COMMENT: Message2 +message Message2 { + // COMMENT: Message2A + message Message2A { + } + + // COMMENT: Message2B + message Message2B { + } +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/comments/deprecated.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/comments/deprecated.proto new file mode 100644 index 00000000..daac493b --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/comments/deprecated.proto @@ -0,0 +1,20 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; + +package goproto.protoc.comments; + +option deprecated = true; +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/comments"; + +message DeprecatedMessage { + option deprecated = true; + string deprecated_field = 1 [deprecated=true]; +} + +enum DeprecatedEnum { + option deprecated = true; + DEPRECATED = 0 [deprecated=true]; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/base/base.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/base/base.proto new file mode 100644 index 00000000..32d242ed --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/base/base.proto @@ -0,0 +1,20 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package goproto.protoc.extension.base; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/base"; + +message BaseMessage { + optional string field = 1; + extensions 4 to 9; + extensions 16 to max; +} + +message MessageSetWireFormatMessage { + option message_set_wire_format = true; + extensions 100 to max; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/ext/ext.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/ext/ext.proto new file mode 100644 index 00000000..5156c1c6 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/ext/ext.proto @@ -0,0 +1,108 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +import "cmd/protoc-gen-go/testdata/extensions/base/base.proto"; +import "cmd/protoc-gen-go/testdata/extensions/extra/extra.proto"; + +package goproto.protoc.extension.ext; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/ext"; + +message Message { + optional bytes data = 1; + + message M {} +} + +enum Enum { + ZERO = 0; +} + +// Extend with various types. +extend goproto.protoc.extension.base.BaseMessage { + optional bool extension_bool = 101; + optional Enum extension_enum = 102; + optional int32 extension_int32 = 103; + optional sint32 extension_sint32 = 104; + optional uint32 extension_uint32 = 105; + optional int64 extension_int64 = 106; + optional sint64 extension_sint64 = 107; + optional uint64 extension_uint64 = 108; + optional sfixed32 extension_sfixed32 = 109; + optional fixed32 extension_fixed32 = 110; + optional float extension_float = 111; + optional sfixed64 extension_sfixed64 = 112; + optional fixed64 extension_fixed64 = 113; + optional double extension_double = 114; + optional string extension_string = 115; + optional bytes extension_bytes = 116; + optional Message extension_Message = 117; + optional Message.M extension_MessageM = 118; + optional group ExtensionGroup = 119 { + optional string extension_group = 120; + } +} + +// Extend with a foreign message. +extend goproto.protoc.extension.base.BaseMessage { + optional goproto.protoc.extension.extra.ExtraMessage extra_message = 9; +} + +// Extend in the scope of another type. +message ExtendingMessage { + extend goproto.protoc.extension.base.BaseMessage { + optional string extending_message_string = 200; + optional ExtendingMessageSubmessage extending_message_submessage = 201; + } + message ExtendingMessageSubmessage {} +} + +// Extend with repeated fields. +extend goproto.protoc.extension.base.BaseMessage { + repeated bool repeated_x_bool = 301; + repeated Enum repeated_x_enum = 302; + repeated int32 repeated_x_int32 = 303; + repeated sint32 repeated_x_sint32 = 304; + repeated uint32 repeated_x_uint32 = 305; + repeated int64 repeated_x_int64 = 306; + repeated sint64 repeated_x_sint64 = 307; + repeated uint64 repeated_x_uint64 = 308; + repeated sfixed32 repeated_x_sfixed32 = 309; + repeated fixed32 repeated_x_fixed32 = 310; + repeated float repeated_x_float = 311; + repeated sfixed64 repeated_x_sfixed64 = 312; + repeated fixed64 repeated_x_fixed64 = 313; + repeated double repeated_x_double = 314; + repeated string repeated_x_string = 315; + repeated bytes repeated_x_bytes = 316; + repeated Message repeated_x_Message = 317; + repeated group RepeatedGroup = 318 { + repeated string repeated_x_group = 319; + } +} + +// An extension of an extension. +message Extendable { + extensions 1 to max; +} +extend goproto.protoc.extension.base.BaseMessage { + optional Extendable extendable_field = 400; +} +extend Extendable { + optional string extendable_string_field = 1; +} + +// Message set wire format. +message MessageSetWireFormatExtension { + extend goproto.protoc.extension.base.MessageSetWireFormatMessage { + optional MessageSetWireFormatExtension message_set_extension = 100; + } +} + +// Message set extension, not nested in a message. +extend goproto.protoc.extension.base.MessageSetWireFormatMessage { + optional MessageSetWireFormatExtension message_set_extension = 101; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/extra/extra.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/extra/extra.proto new file mode 100644 index 00000000..eeea4238 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/extra/extra.proto @@ -0,0 +1,13 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package goproto.protoc.extension.extra; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/extra"; + +message ExtraMessage { + optional bytes data = 1; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.proto new file mode 100644 index 00000000..3d48c1fa --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.proto @@ -0,0 +1,53 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; + +import "google/protobuf/descriptor.proto"; + +package goproto.protoc.extension.proto3; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/proto3"; + +message Message {} +enum Enum { ZERO = 0; } + +// The only types proto3 is allowed to extend are descriptor options. +extend google.protobuf.MessageOptions { + bool extension_bool = 1001; + Enum extension_enum = 1002; + int32 extension_int32 = 1003; + sint32 extension_sint32 = 1004; + uint32 extension_uint32 = 1005; + int64 extension_int64 = 1006; + sint64 extension_sint64 = 1007; + uint64 extension_uint64 = 1008; + sfixed32 extension_sfixed32 = 1009; + fixed32 extension_fixed32 = 1010; + float extension_float = 1011; + sfixed64 extension_sfixed64 = 1012; + fixed64 extension_fixed64 = 1013; + double extension_double = 1014; + string extension_string = 1015; + bytes extension_bytes = 1016; + Message extension_Message = 1017; + + repeated bool repeated_extension_bool = 2001; + repeated Enum repeated_extension_enum = 2002; + repeated int32 repeated_extension_int32 = 2003; + repeated sint32 repeated_extension_sint32 = 2004; + repeated uint32 repeated_extension_uint32 = 2005; + repeated int64 repeated_extension_int64 = 2006; + repeated sint64 repeated_extension_sint64 = 2007; + repeated uint64 repeated_extension_uint64 = 2008; + repeated sfixed32 repeated_extension_sfixed32 = 2009; + repeated fixed32 repeated_extension_fixed32 = 2010; + repeated float repeated_extension_float = 2011; + repeated sfixed64 repeated_extension_sfixed64 = 2012; + repeated fixed64 repeated_extension_fixed64 = 2013; + repeated double repeated_extension_double = 2014; + repeated string repeated_extension_string = 2015; + repeated bytes repeated_extension_bytes = 2016; + repeated Message repeated_extension_Message = 2017; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.proto new file mode 100644 index 00000000..00f6752e --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.proto @@ -0,0 +1,55 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package goproto.protoc.fieldnames; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/fieldnames"; + +// Assorted edge cases in field name conflict resolution. +// +// Not all (or possibly any) of these behave in an easily-understood fashion. +// This exists to demonstrate the current behavior and catch unintended +// changes in it. +message Message { + // Various CamelCase conversions. + optional string field_one = 1; + optional string FieldTwo = 2; + optional string fieldThree = 3; + optional string field__four = 4; + + // Field names that conflict with standard methods on the message struct. + optional string descriptor = 10; + optional string marshal = 11; + optional string unmarshal = 12; + optional string proto_message = 13; + + // Field names that conflict with each other after CamelCasing. + optional string CamelCase = 20; + optional string CamelCase_ = 21; + optional string camel_case = 22; // conflicts with 20, 21 + optional string CamelCase__ = 23; // conflicts with 21, 21, renamed 22 + + // Field with a getter that conflicts with another field. + optional string get_name = 30; + optional string name = 31; + + // Oneof that conflicts with its first field: The oneof is renamed. + oneof oneof_conflict_a { + string OneofConflictA = 40; + } + + // Oneof that conflicts with its second field: The field is renamed. + oneof oneof_conflict_b { + string oneof_no_conflict = 50; + string OneofConflictB = 51; + } + + // Oneof with a field name that conflicts with a nested message. + oneof oneof_conflict_c { + string oneof_message_conflict = 60; + } + message OneofMessageConflict {} +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/a.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/a.proto new file mode 100644 index 00000000..62101252 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/a.proto @@ -0,0 +1,18 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package goproto.protoc.import_public; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public"; + +import public "cmd/protoc-gen-go/testdata/import_public/sub/a.proto"; // Different Go package. +import public "cmd/protoc-gen-go/testdata/import_public/b.proto"; // Same Go package. + +message Public { + optional goproto.protoc.import_public.sub.M m = 1; + optional goproto.protoc.import_public.sub.E e = 2; + optional Local local = 3; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/b.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/b.proto new file mode 100644 index 00000000..f710dcec --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/b.proto @@ -0,0 +1,16 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package goproto.protoc.import_public; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public"; + +import "cmd/protoc-gen-go/testdata/import_public/sub/a.proto"; + +message Local { + optional goproto.protoc.import_public.sub.M m = 1; + optional goproto.protoc.import_public.sub.E e = 2; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/c.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/c.proto new file mode 100644 index 00000000..86b02a38 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/c.proto @@ -0,0 +1,19 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package goproto.protoc.import_public; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public"; + +import "cmd/protoc-gen-go/testdata/import_public/a.proto"; + +message UsingPublicImport { + // Local is declared in b.proto, which is a public import of a.proto. + optional Local local = 1; + // Sub2Message is declared in sub2/a.proto, which is a public import of + // sub/a.proto, which is a public import of a.proto. + optional sub2.Sub2Message sub2 = 2; // declared in sub2/a.proto +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub/a.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub/a.proto new file mode 100644 index 00000000..9fa4cb85 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub/a.proto @@ -0,0 +1,50 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package goproto.protoc.import_public.sub; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub"; + +import "cmd/protoc-gen-go/testdata/import_public/sub/b.proto"; +import public "cmd/protoc-gen-go/testdata/import_public/sub2/a.proto"; + +message M { + // Field using a type in the same Go package, but a different source file. + optional M2 m2 = 1; + optional string s = 4 [default="default"]; + optional bytes b = 5 [default="default"]; + optional double f = 6 [default=nan]; + + oneof oneof_field { + int32 oneof_int32 = 2; + int64 oneof_int64 = 3; + } + + message Submessage { + enum Submessage_Subenum { + M_SUBMESSAGE_ZERO = 0; + } + + oneof submessage_oneof_field { + int32 submessage_oneof_int32 = 1; + int64 submessage_oneof_int64 = 2; + } + } + + enum Subenum { + M_ZERO = 0; + } + + extensions 100 to max; +} + +extend M { + optional string extension_field = 100; +} + +enum E { + ZERO = 0; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub/b.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub/b.proto new file mode 100644 index 00000000..2f1bb5d6 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub/b.proto @@ -0,0 +1,12 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package goproto.protoc.import_public.sub; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub"; + +message M2 { +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub2/a.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub2/a.proto new file mode 100644 index 00000000..ec8aa909 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub2/a.proto @@ -0,0 +1,11 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package goproto.protoc.import_public.sub2; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub2"; + +message Sub2Message {} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/fmt/m.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/fmt/m.proto new file mode 100644 index 00000000..580c2b5d --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/fmt/m.proto @@ -0,0 +1,8 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; +package fmt; +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/fmt"; +message M {} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_1/m1.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_1/m1.proto new file mode 100644 index 00000000..0c2f3e12 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_1/m1.proto @@ -0,0 +1,17 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; +package test.a; +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_1"; + +message M1 {} + +message M1_1 { + M1 m1 = 1; +} + +enum E1 { + E1_ZERO = 0; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_1/m2.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_1/m2.proto new file mode 100644 index 00000000..31aa9096 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_1/m2.proto @@ -0,0 +1,8 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; +package test.a; +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_1"; +message M2 {} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_2/m3.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_2/m3.proto new file mode 100644 index 00000000..c9b3f346 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_2/m3.proto @@ -0,0 +1,8 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; +package test.a; +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_2"; +message M3 {} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_2/m4.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_2/m4.proto new file mode 100644 index 00000000..248e0732 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_2/m4.proto @@ -0,0 +1,8 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; +package test.a; +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_2"; +message M4 {} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_b_1/m1.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_b_1/m1.proto new file mode 100644 index 00000000..77e0fc6e --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_b_1/m1.proto @@ -0,0 +1,8 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; +package test.b.part1; +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_b_1;beta"; +message M1 {} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_b_1/m2.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_b_1/m2.proto new file mode 100644 index 00000000..ed68630c --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_b_1/m2.proto @@ -0,0 +1,8 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; +package test.b.part2; +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_b_1;beta"; +message M2 {} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_import_a1m1.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_import_a1m1.proto new file mode 100644 index 00000000..670e62e2 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_import_a1m1.proto @@ -0,0 +1,15 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; + +package test; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports"; + +import "cmd/protoc-gen-go/testdata/imports/test_a_1/m1.proto"; + +message A1M1 { + test.a.M1 f = 1; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_import_a1m2.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_import_a1m2.proto new file mode 100644 index 00000000..8cef2809 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_import_a1m2.proto @@ -0,0 +1,15 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; + +package test; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports"; + +import "cmd/protoc-gen-go/testdata/imports/test_a_1/m2.proto"; + +message A1M2 { + test.a.M2 f = 1; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_import_all.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_import_all.proto new file mode 100644 index 00000000..3909f2de --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_import_all.proto @@ -0,0 +1,29 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; + +package test; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports"; + +// test_a_1/m*.proto are in the same Go package and proto package. +// test_a_*/*.proto are in different Go packages, but the same proto package. +// test_b_1/*.proto are in the same Go package, but different proto packages. +// fmt/m.proto has a package name which conflicts with "fmt". +import "cmd/protoc-gen-go/testdata/imports/test_a_1/m1.proto"; +import "cmd/protoc-gen-go/testdata/imports/test_a_1/m2.proto"; +import "cmd/protoc-gen-go/testdata/imports/test_a_2/m3.proto"; // unused in this file +import "cmd/protoc-gen-go/testdata/imports/test_a_2/m4.proto"; // unused in this file +import "cmd/protoc-gen-go/testdata/imports/test_b_1/m1.proto"; +import "cmd/protoc-gen-go/testdata/imports/test_b_1/m2.proto"; +import "cmd/protoc-gen-go/testdata/imports/fmt/m.proto"; + +message All { + test.a.M1 am1 = 1; + test.a.M2 am2 = 2; + test.b.part1.M1 bm1 = 5; + test.b.part2.M2 bm2 = 6; + fmt.M fmt = 7; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/test.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/test.proto new file mode 100644 index 00000000..d6d269da --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/test.proto @@ -0,0 +1,15 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package oneoftest; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/issue780_oneof_conflict"; + +message Foo { + oneof bar { // must be generated as Bar field in Foo struct + string get_bar = 1; + } +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/nopackage/nopackage.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/nopackage/nopackage.proto new file mode 100644 index 00000000..892bb066 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/nopackage/nopackage.proto @@ -0,0 +1,16 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +// File contains no 'package' statement. + +enum Enum { + ZERO = 0; +} + +message Message { + optional string string_field = 1; + optional Enum enum_field = 2 [default=ZERO]; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2/enum.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2/enum.proto new file mode 100644 index 00000000..c30c8ecf --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2/enum.proto @@ -0,0 +1,54 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package goproto.protoc.proto2; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2"; + +// EnumType1 comment. +enum EnumType1 { + // EnumType1_ONE comment. + ONE = 1; + // EnumType1_TWO comment. + TWO = 2; +} + +enum EnumType2 { + option allow_alias = true; + duplicate1 = 1; + duplicate2 = 1; + + reserved "RESERVED1"; + reserved "RESERVED2"; + reserved 2, 3; +} + +message EnumContainerMessage1 { + optional EnumType2 default_duplicate1 = 1 [default=duplicate1]; + optional EnumType2 default_duplicate2 = 2 [default=duplicate2]; + + // NestedEnumType1A comment. + enum NestedEnumType1A { + // NestedEnumType1A_VALUE comment. + NESTED_1A_VALUE = 0; + } + + enum NestedEnumType1B { + NESTED_1B_VALUE = 0; + } + + message EnumContainerMessage2 { + // NestedEnumType2A comment. + enum NestedEnumType2A { + // NestedEnumType2A_VALUE comment. + NESTED_2A_VALUE = 0; + } + + enum NestedEnumType2B { + NESTED_2B_VALUE = 0; + } + } +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2/fields.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2/fields.proto new file mode 100644 index 00000000..f3c4c915 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2/fields.proto @@ -0,0 +1,143 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package goproto.protoc.proto2; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2"; + +message FieldTestMessage { + optional bool optional_bool = 1; + optional Enum optional_enum = 2; + optional int32 optional_int32 = 3; + optional sint32 optional_sint32 = 4; + optional uint32 optional_uint32 = 5; + optional int64 optional_int64 = 6; + optional sint64 optional_sint64 = 7; + optional uint64 optional_uint64 = 8; + optional sfixed32 optional_sfixed32 = 9; + optional fixed32 optional_fixed32 = 10; + optional float optional_float = 11; + optional sfixed64 optional_sfixed64 = 12; + optional fixed64 optional_fixed64 = 13; + optional double optional_double = 14; + optional string optional_string = 15; + optional bytes optional_bytes = 16; + optional Message optional_Message = 17; + optional group OptionalGroup = 18 { + optional string optional_group = 19; + } + + required bool required_bool = 101; + required Enum required_enum = 102; + required int32 required_int32 = 103; + required sint32 required_sint32 = 104; + required uint32 required_uint32 = 105; + required int64 required_int64 = 106; + required sint64 required_sint64 = 107; + required uint64 required_uint64 = 108; + required sfixed32 required_sfixed32 = 109; + required fixed32 required_fixed32 = 110; + required float required_float = 111; + required sfixed64 required_sfixed64 = 112; + required fixed64 required_fixed64 = 113; + required double required_double = 114; + required string required_string = 115; + required bytes required_bytes = 116; + required Message required_Message = 117; + required group RequiredGroup = 118 { + required string required_group = 119; + } + + repeated bool repeated_bool = 201; + repeated Enum repeated_enum = 202; + repeated int32 repeated_int32 = 203; + repeated sint32 repeated_sint32 = 204; + repeated uint32 repeated_uint32 = 205; + repeated int64 repeated_int64 = 206; + repeated sint64 repeated_sint64 = 207; + repeated uint64 repeated_uint64 = 208; + repeated sfixed32 repeated_sfixed32 = 209; + repeated fixed32 repeated_fixed32 = 210; + repeated float repeated_float = 211; + repeated sfixed64 repeated_sfixed64 = 212; + repeated fixed64 repeated_fixed64 = 213; + repeated double repeated_double = 214; + repeated string repeated_string = 215; + repeated bytes repeated_bytes = 216; + repeated Message repeated_Message = 217; + repeated group RepeatedGroup = 218 { + repeated string repeated_group = 219; + } + + optional bool default_bool = 301 [default=true]; + optional Enum default_enum = 302 [default=ONE]; + optional int32 default_int32 = 303 [default=1]; + optional sint32 default_sint32 = 304 [default=1]; + optional uint32 default_uint32 = 305 [default=1]; + optional int64 default_int64 = 306 [default=1]; + optional sint64 default_sint64 = 307 [default=1]; + optional uint64 default_uint64 = 308 [default=1]; + optional sfixed32 default_sfixed32 = 309 [default=1]; + optional fixed32 default_fixed32 = 310 [default=1]; + optional float default_float = 311 [default=3.14]; + optional sfixed64 default_sfixed64 = 312 [default=1]; + optional fixed64 default_fixed64 = 313 [default=1]; + optional double default_double = 314 [default=3.1415]; + optional string default_string = 315 [default="hello,\"world!\"\n"]; + optional bytes default_bytes = 316 [default="hello,\xde\xad\xbe\xef"]; + + optional string default_zero_string = 350 [default=""]; + optional bytes default_zero_bytes = 351 [default=""]; + + optional float default_float_neginf = 400 [default=-inf]; + optional float default_float_posinf = 401 [default=inf]; + optional float default_float_nan = 402 [default=nan]; + optional double default_double_neginf = 403 [default=-inf]; + optional double default_double_posinf = 404 [default=inf]; + optional double default_double_nan = 405 [default=nan]; + + map map_int32_int64 = 500; + map map_string_message = 501; + map map_fixed64_enum = 502; + + oneof oneof_field { + bool oneof_bool = 601; + Enum oneof_enum = 602; + int32 oneof_int32 = 603; + sint32 oneof_sint32 = 604; + uint32 oneof_uint32 = 605; + int64 oneof_int64 = 606; + sint64 oneof_sint64 = 607; + uint64 oneof_uint64 = 608; + sfixed32 oneof_sfixed32 = 609; + fixed32 oneof_fixed32 = 610; + float oneof_float = 611; + sfixed64 oneof_sfixed64 = 612; + fixed64 oneof_fixed64 = 613; + double oneof_double = 614; + string oneof_string = 615; + bytes oneof_bytes = 616; + Message oneof_Message = 617; + group OneofGroup = 618 { + optional string oneof_group_field = 619; + } + int32 oneof_largest_tag = 536870911; + } + + oneof oneof_two { + int32 oneof_two_1 = 700; + int64 oneof_two_2 = 701; + } + + enum Enum { + ZERO = 0; + ONE = 1; + } + message Message {} + + reserved 10000, 10001; + reserved "TEN_THOUSAND", "TEN_THOUSAND_AND_ONE"; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2/nested_messages.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2/nested_messages.proto new file mode 100644 index 00000000..e42af75f --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2/nested_messages.proto @@ -0,0 +1,19 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package goproto.protoc.proto2; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2"; + +message Layer1 { + message Layer2 { + message Layer3 { + } + optional Layer3 l3 = 1; + } + optional Layer2 l2 = 1; + optional Layer2.Layer3 l3 = 2; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2/proto2.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2/proto2.proto new file mode 100644 index 00000000..55e052eb --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2/proto2.proto @@ -0,0 +1,15 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto2"; + +package goproto.protoc.proto2; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2"; + +message Message { + optional int32 i32 = 1; + + optional Message m = 2; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto3/enum.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto3/enum.proto new file mode 100644 index 00000000..595af3d9 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto3/enum.proto @@ -0,0 +1,15 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; + +package goproto.protoc.proto3; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto3"; + +enum Enum { + ZERO = 0; + ONE = 1; + TWO = 2; +} diff --git a/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto3/fields.proto b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto3/fields.proto new file mode 100644 index 00000000..1dfd7057 --- /dev/null +++ b/vendor/google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto3/fields.proto @@ -0,0 +1,55 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; + +package goproto.protoc.proto3; + +option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto3"; + +message FieldTestMessage { + string optional_bool = 1; + Enum optional_enum = 2; + int32 optional_int32 = 3; + sint32 optional_sint32 = 4; + uint32 optional_uint32 = 5; + int64 optional_int64 = 6; + sint64 optional_sint64 = 7; + uint64 optional_uint64 = 8; + sfixed32 optional_sfixed32 = 9; + fixed32 optional_fixed32 = 10; + float optional_float = 11; + sfixed64 optional_sfixed64 = 12; + fixed64 optional_fixed64 = 13; + double optional_double = 14; + string optional_string = 15; + bytes optional_bytes = 16; + Message optional_Message = 17; + + repeated bool repeated_bool = 201; + repeated Enum repeated_enum = 202; + repeated int32 repeated_int32 = 203; + repeated sint32 repeated_sint32 = 204; + repeated uint32 repeated_uint32 = 205; + repeated int64 repeated_int64 = 206; + repeated sint64 repeated_sint64 = 207; + repeated uint64 repeated_uint64 = 208; + repeated sfixed32 repeated_sfixed32 = 209; + repeated fixed32 repeated_fixed32 = 210; + repeated float repeated_float = 211; + repeated sfixed64 repeated_sfixed64 = 212; + repeated fixed64 repeated_fixed64 = 213; + repeated double repeated_double = 214; + repeated string repeated_string = 215; + repeated bytes repeated_bytes = 216; + repeated Message repeated_Message = 217; + + map map_int32_int64 = 500; + map map_string_message = 501; + map map_fixed64_enum = 502; + + enum Enum { ZERO = 0; } + message Message {} +} + diff --git a/vendor/modules.txt b/vendor/modules.txt index d4800095..5df66eec 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -161,7 +161,6 @@ github.com/golang/groupcache/lru # github.com/golang/protobuf v1.4.2 ## explicit; go 1.9 github.com/golang/protobuf/internal/gengogrpc -github.com/golang/protobuf/jsonpb github.com/golang/protobuf/proto github.com/golang/protobuf/protoc-gen-go github.com/golang/protobuf/ptypes @@ -450,6 +449,7 @@ google.golang.org/grpc/status google.golang.org/grpc/tap # google.golang.org/protobuf v1.25.0 ## explicit; go 1.9 +google.golang.org/protobuf/cmd/protoc-gen-go google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo google.golang.org/protobuf/compiler/protogen google.golang.org/protobuf/encoding/protojson