From 62d30d1b956bbc7f4249e3b42c6f8b3e5db26789 Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Fri, 20 Feb 2015 11:04:20 +0100 Subject: [PATCH] Replace depricated ErrWrongType with its local definition --- etcdserver/etcdserverpb/etcdserver.pb.go | 39 ++++++++++--------- migrate/etcd4pb/log_entry.pb.go | 10 +++-- raft/raftpb/raft.pb.go | 64 ++++++++++++++++++-------------- snap/snappb/snap.pb.go | 6 ++- wal/walpb/record.pb.go | 13 ++++--- 5 files changed, 75 insertions(+), 57 deletions(-) diff --git a/etcdserver/etcdserverpb/etcdserver.pb.go b/etcdserver/etcdserverpb/etcdserver.pb.go index 2e8afc0..42eb0c2 100644 --- a/etcdserver/etcdserverpb/etcdserver.pb.go +++ b/etcdserver/etcdserverpb/etcdserver.pb.go @@ -22,6 +22,7 @@ import math "math" import io "io" import code_google_com_p_gogoprotobuf_proto "code.google.com/p/gogoprotobuf/proto" +import errors "errors" // Reference proto, json, and math imports to suppress error if they are not otherwise used. var _ = proto.Marshal @@ -67,6 +68,7 @@ func init() { func (m *Request) Unmarshal(data []byte) error { l := len(data) index := 0 + var ErrWrongType = errors.New("proto: field/encoding mismatch: wrong type for field") for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -85,7 +87,7 @@ func (m *Request) Unmarshal(data []byte) error { switch fieldNum { case 1: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -100,7 +102,7 @@ func (m *Request) Unmarshal(data []byte) error { } case 2: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -122,7 +124,7 @@ func (m *Request) Unmarshal(data []byte) error { index = postIndex case 3: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -144,7 +146,7 @@ func (m *Request) Unmarshal(data []byte) error { index = postIndex case 4: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -166,7 +168,7 @@ func (m *Request) Unmarshal(data []byte) error { index = postIndex case 5: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var v int for shift := uint(0); ; shift += 7 { @@ -183,7 +185,7 @@ func (m *Request) Unmarshal(data []byte) error { m.Dir = bool(v != 0) case 6: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -205,7 +207,7 @@ func (m *Request) Unmarshal(data []byte) error { index = postIndex case 7: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -220,7 +222,7 @@ func (m *Request) Unmarshal(data []byte) error { } case 8: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var v int for shift := uint(0); ; shift += 7 { @@ -238,7 +240,7 @@ func (m *Request) Unmarshal(data []byte) error { m.PrevExist = &b case 9: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -253,7 +255,7 @@ func (m *Request) Unmarshal(data []byte) error { } case 10: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var v int for shift := uint(0); ; shift += 7 { @@ -270,7 +272,7 @@ func (m *Request) Unmarshal(data []byte) error { m.Wait = bool(v != 0) case 11: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -285,7 +287,7 @@ func (m *Request) Unmarshal(data []byte) error { } case 12: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var v int for shift := uint(0); ; shift += 7 { @@ -302,7 +304,7 @@ func (m *Request) Unmarshal(data []byte) error { m.Recursive = bool(v != 0) case 13: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var v int for shift := uint(0); ; shift += 7 { @@ -319,7 +321,7 @@ func (m *Request) Unmarshal(data []byte) error { m.Sorted = bool(v != 0) case 14: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var v int for shift := uint(0); ; shift += 7 { @@ -336,7 +338,7 @@ func (m *Request) Unmarshal(data []byte) error { m.Quorum = bool(v != 0) case 15: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -351,7 +353,7 @@ func (m *Request) Unmarshal(data []byte) error { } case 16: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var v int for shift := uint(0); ; shift += 7 { @@ -392,6 +394,7 @@ func (m *Request) Unmarshal(data []byte) error { func (m *Metadata) Unmarshal(data []byte) error { l := len(data) index := 0 + var ErrWrongType = errors.New("proto: field/encoding mismatch: wrong type for field") for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -410,7 +413,7 @@ func (m *Metadata) Unmarshal(data []byte) error { switch fieldNum { case 1: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -425,7 +428,7 @@ func (m *Metadata) Unmarshal(data []byte) error { } case 2: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { diff --git a/migrate/etcd4pb/log_entry.pb.go b/migrate/etcd4pb/log_entry.pb.go index c969241..0ccc80d 100644 --- a/migrate/etcd4pb/log_entry.pb.go +++ b/migrate/etcd4pb/log_entry.pb.go @@ -12,6 +12,7 @@ import math "math" import io "io" import code_google_com_p_gogoprotobuf_proto "code.google.com/p/gogoprotobuf/proto" +import errors "errors" import fmt "fmt" import strings "strings" @@ -76,6 +77,7 @@ func init() { func (m *LogEntry) Unmarshal(data []byte) error { l := len(data) index := 0 + var ErrWrongType = errors.New("proto: field/encoding mismatch: wrong type for field") for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -94,7 +96,7 @@ func (m *LogEntry) Unmarshal(data []byte) error { switch fieldNum { case 1: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var v uint64 for shift := uint(0); ; shift += 7 { @@ -111,7 +113,7 @@ func (m *LogEntry) Unmarshal(data []byte) error { m.Index = &v case 2: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var v uint64 for shift := uint(0); ; shift += 7 { @@ -128,7 +130,7 @@ func (m *LogEntry) Unmarshal(data []byte) error { m.Term = &v case 3: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -151,7 +153,7 @@ func (m *LogEntry) Unmarshal(data []byte) error { index = postIndex case 4: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var byteLen int for shift := uint(0); ; shift += 7 { diff --git a/raft/raftpb/raft.pb.go b/raft/raftpb/raft.pb.go index 88a08fd..ec40c14 100644 --- a/raft/raftpb/raft.pb.go +++ b/raft/raftpb/raft.pb.go @@ -27,6 +27,7 @@ import math "math" import io "io" import code_google_com_p_gogoprotobuf_proto "code.google.com/p/gogoprotobuf/proto" +import errors "errors" // Reference proto, json, and math imports to suppress error if they are not otherwise used. var _ = proto.Marshal @@ -251,6 +252,7 @@ func init() { func (m *Entry) Unmarshal(data []byte) error { l := len(data) index := 0 + var ErrWrongType = errors.New("proto: field/encoding mismatch: wrong type for field") for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -269,7 +271,7 @@ func (m *Entry) Unmarshal(data []byte) error { switch fieldNum { case 1: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -284,7 +286,7 @@ func (m *Entry) Unmarshal(data []byte) error { } case 2: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -299,7 +301,7 @@ func (m *Entry) Unmarshal(data []byte) error { } case 3: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -314,7 +316,7 @@ func (m *Entry) Unmarshal(data []byte) error { } case 4: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var byteLen int for shift := uint(0); ; shift += 7 { @@ -360,6 +362,7 @@ func (m *Entry) Unmarshal(data []byte) error { func (m *SnapshotMetadata) Unmarshal(data []byte) error { l := len(data) index := 0 + var ErrWrongType = errors.New("proto: field/encoding mismatch: wrong type for field") for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -378,7 +381,7 @@ func (m *SnapshotMetadata) Unmarshal(data []byte) error { switch fieldNum { case 1: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var msglen int for shift := uint(0); ; shift += 7 { @@ -402,7 +405,7 @@ func (m *SnapshotMetadata) Unmarshal(data []byte) error { index = postIndex case 2: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -417,7 +420,7 @@ func (m *SnapshotMetadata) Unmarshal(data []byte) error { } case 3: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -456,6 +459,7 @@ func (m *SnapshotMetadata) Unmarshal(data []byte) error { func (m *Snapshot) Unmarshal(data []byte) error { l := len(data) index := 0 + var ErrWrongType = errors.New("proto: field/encoding mismatch: wrong type for field") for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -474,7 +478,7 @@ func (m *Snapshot) Unmarshal(data []byte) error { switch fieldNum { case 1: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var byteLen int for shift := uint(0); ; shift += 7 { @@ -496,7 +500,7 @@ func (m *Snapshot) Unmarshal(data []byte) error { index = postIndex case 2: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var msglen int for shift := uint(0); ; shift += 7 { @@ -544,6 +548,7 @@ func (m *Snapshot) Unmarshal(data []byte) error { func (m *Message) Unmarshal(data []byte) error { l := len(data) index := 0 + var ErrWrongType = errors.New("proto: field/encoding mismatch: wrong type for field") for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -562,7 +567,7 @@ func (m *Message) Unmarshal(data []byte) error { switch fieldNum { case 1: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -577,7 +582,7 @@ func (m *Message) Unmarshal(data []byte) error { } case 2: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -592,7 +597,7 @@ func (m *Message) Unmarshal(data []byte) error { } case 3: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -607,7 +612,7 @@ func (m *Message) Unmarshal(data []byte) error { } case 4: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -622,7 +627,7 @@ func (m *Message) Unmarshal(data []byte) error { } case 5: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -637,7 +642,7 @@ func (m *Message) Unmarshal(data []byte) error { } case 6: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -652,7 +657,7 @@ func (m *Message) Unmarshal(data []byte) error { } case 7: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var msglen int for shift := uint(0); ; shift += 7 { @@ -675,7 +680,7 @@ func (m *Message) Unmarshal(data []byte) error { index = postIndex case 8: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -690,7 +695,7 @@ func (m *Message) Unmarshal(data []byte) error { } case 9: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var msglen int for shift := uint(0); ; shift += 7 { @@ -714,7 +719,7 @@ func (m *Message) Unmarshal(data []byte) error { index = postIndex case 10: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var v int for shift := uint(0); ; shift += 7 { @@ -731,7 +736,7 @@ func (m *Message) Unmarshal(data []byte) error { m.Reject = bool(v != 0) case 11: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -770,6 +775,7 @@ func (m *Message) Unmarshal(data []byte) error { func (m *HardState) Unmarshal(data []byte) error { l := len(data) index := 0 + var ErrWrongType = errors.New("proto: field/encoding mismatch: wrong type for field") for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -788,7 +794,7 @@ func (m *HardState) Unmarshal(data []byte) error { switch fieldNum { case 1: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -803,7 +809,7 @@ func (m *HardState) Unmarshal(data []byte) error { } case 2: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -818,7 +824,7 @@ func (m *HardState) Unmarshal(data []byte) error { } case 3: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -857,6 +863,7 @@ func (m *HardState) Unmarshal(data []byte) error { func (m *ConfState) Unmarshal(data []byte) error { l := len(data) index := 0 + var ErrWrongType = errors.New("proto: field/encoding mismatch: wrong type for field") for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -875,7 +882,7 @@ func (m *ConfState) Unmarshal(data []byte) error { switch fieldNum { case 1: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var v uint64 for shift := uint(0); ; shift += 7 { @@ -916,6 +923,7 @@ func (m *ConfState) Unmarshal(data []byte) error { func (m *ConfChange) Unmarshal(data []byte) error { l := len(data) index := 0 + var ErrWrongType = errors.New("proto: field/encoding mismatch: wrong type for field") for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -934,7 +942,7 @@ func (m *ConfChange) Unmarshal(data []byte) error { switch fieldNum { case 1: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -949,7 +957,7 @@ func (m *ConfChange) Unmarshal(data []byte) error { } case 2: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -964,7 +972,7 @@ func (m *ConfChange) Unmarshal(data []byte) error { } case 3: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -979,7 +987,7 @@ func (m *ConfChange) Unmarshal(data []byte) error { } case 4: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var byteLen int for shift := uint(0); ; shift += 7 { diff --git a/snap/snappb/snap.pb.go b/snap/snappb/snap.pb.go index 1bc8927..8a5b7d2 100644 --- a/snap/snappb/snap.pb.go +++ b/snap/snappb/snap.pb.go @@ -21,6 +21,7 @@ import math "math" import io "io" import code_google_com_p_gogoprotobuf_proto "code.google.com/p/gogoprotobuf/proto" +import errors "errors" // Reference proto, json, and math imports to suppress error if they are not otherwise used. var _ = proto.Marshal @@ -42,6 +43,7 @@ func init() { func (m *Snapshot) Unmarshal(data []byte) error { l := len(data) index := 0 + var ErrWrongType = errors.New("proto: field/encoding mismatch: wrong type for field") for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -60,7 +62,7 @@ func (m *Snapshot) Unmarshal(data []byte) error { switch fieldNum { case 1: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -75,7 +77,7 @@ func (m *Snapshot) Unmarshal(data []byte) error { } case 2: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var byteLen int for shift := uint(0); ; shift += 7 { diff --git a/wal/walpb/record.pb.go b/wal/walpb/record.pb.go index e556f51..2877b6e 100644 --- a/wal/walpb/record.pb.go +++ b/wal/walpb/record.pb.go @@ -22,6 +22,7 @@ import math "math" import io "io" import code_google_com_p_gogoprotobuf_proto "code.google.com/p/gogoprotobuf/proto" +import errors "errors" // Reference proto, json, and math imports to suppress error if they are not otherwise used. var _ = proto.Marshal @@ -54,6 +55,7 @@ func init() { func (m *Record) Unmarshal(data []byte) error { l := len(data) index := 0 + var ErrWrongType = errors.New("proto: field/encoding mismatch: wrong type for field") for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -72,7 +74,7 @@ func (m *Record) Unmarshal(data []byte) error { switch fieldNum { case 1: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -87,7 +89,7 @@ func (m *Record) Unmarshal(data []byte) error { } case 2: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -102,7 +104,7 @@ func (m *Record) Unmarshal(data []byte) error { } case 3: if wireType != 2 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } var byteLen int for shift := uint(0); ; shift += 7 { @@ -148,6 +150,7 @@ func (m *Record) Unmarshal(data []byte) error { func (m *Snapshot) Unmarshal(data []byte) error { l := len(data) index := 0 + var ErrWrongType = errors.New("proto: field/encoding mismatch: wrong type for field") for index < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -166,7 +169,7 @@ func (m *Snapshot) Unmarshal(data []byte) error { switch fieldNum { case 1: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { @@ -181,7 +184,7 @@ func (m *Snapshot) Unmarshal(data []byte) error { } case 2: if wireType != 0 { - return code_google_com_p_gogoprotobuf_proto.ErrWrongType + return ErrWrongType } for shift := uint(0); ; shift += 7 { if index >= l { -- 1.9.3