diff --git a/.reuse/dep5 b/.reuse/dep5 index 40163ad..179423a 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -35,6 +35,10 @@ Files: format_string.go Copyright: SPDX-FileCopyrightText: 2022 Comcast Cable Communications Management, LLC License: Apache-2.0 +Files: messages_codec.go +Copyright: SPDX-FileCopyrightText: 2022 Comcast Cable Communications Management, LLC +License: Apache-2.0 + Files: messagetype_string.go Copyright: SPDX-FileCopyrightText: 2022 Comcast Cable Communications Management, LLC License: Apache-2.0 diff --git a/go.mod b/go.mod index b80f24f..ce5893d 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/go-kit/log v0.2.1 github.com/google/uuid v1.5.0 github.com/stretchr/testify v1.8.4 - github.com/ugorji/go/codec v1.2.11 + github.com/ugorji/go/codec v1.2.12 github.com/xmidt-org/httpaux v0.4.0 github.com/xmidt-org/webpa-common v1.11.9 go.uber.org/multierr v1.11.0 diff --git a/go.sum b/go.sum index 3491c87..d0cc3e4 100644 --- a/go.sum +++ b/go.sum @@ -628,8 +628,8 @@ github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqri github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= -github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/vmware/govmomi v0.18.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= diff --git a/messages_codec.go b/messages_codec.go index e6fb29a..263f896 100644 --- a/messages_codec.go +++ b/messages_codec.go @@ -1,6 +1,3 @@ -// SPDX-FileCopyrightText: 2022 Comcast Cable Communications Management, LLC -// SPDX-License-Identifier: Apache-2.0 - //go:build go1.6 // +build go1.6 @@ -10,62 +7,61 @@ package wrp import ( "errors" + codec1978 "github.com/ugorji/go/codec" "runtime" "sort" "strconv" - - codec1978 "github.com/ugorji/go/codec" ) const ( // ----- content types ---- - codecSelferCcUTF84706 = 1 - codecSelferCcRAW4706 = 255 + codecSelferCcUTF83232 = 1 + codecSelferCcRAW3232 = 255 // ----- value types used ---- - codecSelferValueTypeArray4706 = 10 - codecSelferValueTypeMap4706 = 9 - codecSelferValueTypeString4706 = 6 - codecSelferValueTypeInt4706 = 2 - codecSelferValueTypeUint4706 = 3 - codecSelferValueTypeFloat4706 = 4 - codecSelferValueTypeNil4706 = 1 - codecSelferBitsize4706 = uint8(32 << (^uint(0) >> 63)) - codecSelferDecContainerLenNil4706 = -2147483648 + codecSelferValueTypeArray3232 = 10 + codecSelferValueTypeMap3232 = 9 + codecSelferValueTypeString3232 = 6 + codecSelferValueTypeInt3232 = 2 + codecSelferValueTypeUint3232 = 3 + codecSelferValueTypeFloat3232 = 4 + codecSelferValueTypeNil3232 = 1 + codecSelferBitsize3232 = uint8(32 << (^uint(0) >> 63)) + codecSelferDecContainerLenNil3232 = -2147483648 ) var ( - errCodecSelferOnlyMapOrArrayEncodeToStruct4706 = errors.New(`only encoded map or array can be decoded into a struct`) + errCodecSelferOnlyMapOrArrayEncodeToStruct3232 = errors.New(`only encoded map or array can be decoded into a struct`) _ sort.Interface = nil ) -type codecSelfer4706 struct{} +type codecSelfer3232 struct{} -func codecSelfer4706False() bool { return false } -func codecSelfer4706True() bool { return true } +func codecSelfer3232False() bool { return false } +func codecSelfer3232True() bool { return true } -type codecSelfer4706stringSlice []string +type codecSelfer3232stringSlice []string -func (p codecSelfer4706stringSlice) Len() int { return len(p) } -func (p codecSelfer4706stringSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p codecSelfer4706stringSlice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } +func (p codecSelfer3232stringSlice) Len() int { return len(p) } +func (p codecSelfer3232stringSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } +func (p codecSelfer3232stringSlice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } -type codecSelfer4706uint64Slice []uint64 +type codecSelfer3232uint64Slice []uint64 -func (p codecSelfer4706uint64Slice) Len() int { return len(p) } -func (p codecSelfer4706uint64Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p codecSelfer4706uint64Slice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } +func (p codecSelfer3232uint64Slice) Len() int { return len(p) } +func (p codecSelfer3232uint64Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } +func (p codecSelfer3232uint64Slice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } -type codecSelfer4706int64Slice []int64 +type codecSelfer3232int64Slice []int64 -func (p codecSelfer4706int64Slice) Len() int { return len(p) } -func (p codecSelfer4706int64Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p codecSelfer4706int64Slice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } +func (p codecSelfer3232int64Slice) Len() int { return len(p) } +func (p codecSelfer3232int64Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } +func (p codecSelfer3232int64Slice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } -type codecSelfer4706float64Slice []float64 +type codecSelfer3232float64Slice []float64 -func (p codecSelfer4706float64Slice) Len() int { return len(p) } -func (p codecSelfer4706float64Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p codecSelfer4706float64Slice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } +func (p codecSelfer3232float64Slice) Len() int { return len(p) } +func (p codecSelfer3232float64Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } +func (p codecSelfer3232float64Slice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } func init() { if codec1978.GenVersion != 28 { @@ -77,7 +73,7 @@ func init() { func (Message) codecSelferViaCodecgen() {} func (x *Message) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Encoder(e) _, _, _ = h, z, r if z.EncBasicHandle().CheckCircularRef { @@ -690,32 +686,32 @@ func (x *Message) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *Message) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeNil4706 { + if yyct2 == codecSelferValueTypeNil3232 { *(x) = Message{} - } else if yyct2 == codecSelferValueTypeMap4706 { + } else if yyct2 == codecSelferValueTypeMap3232 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { x.codecDecodeSelfFromMap(yyl2, d) } z.DecReadMapEnd() - } else if yyct2 == codecSelferValueTypeArray4706 { + } else if yyct2 == codecSelferValueTypeArray3232 { yyl2 := z.DecReadArrayStart() if yyl2 != 0 { x.codecDecodeSelfFromArray(yyl2, d) } z.DecReadArrayEnd() } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct4706) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct3232) } } func (x *Message) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -795,7 +791,7 @@ func (x *Message) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { if yyxt32 := z.Extension(x.QualityOfService); yyxt32 != nil { z.DecExtension(&x.QualityOfService, yyxt32) } else { - x.QualityOfService = (QOSValue)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize4706)) + x.QualityOfService = (QOSValue)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize3232)) } default: z.DecStructFieldNotFound(-1, string(yys3)) @@ -804,7 +800,7 @@ func (x *Message) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *Message) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r var yyj33 int @@ -994,7 +990,7 @@ func (x *Message) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if yyxt62 := z.Extension(x.QualityOfService); yyxt62 != nil { z.DecExtension(&x.QualityOfService, yyxt62) } else { - x.QualityOfService = (QOSValue)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize4706)) + x.QualityOfService = (QOSValue)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize3232)) } yyj33++ for ; z.DecContainerNext(yyj33, l, yyhl33); yyj33++ { @@ -1009,7 +1005,7 @@ func (x *Message) IsCodecEmpty() bool { func (SimpleRequestResponse) codecSelferViaCodecgen() {} func (x *SimpleRequestResponse) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Encoder(e) _, _, _ = h, z, r if z.EncBasicHandle().CheckCircularRef { @@ -1483,32 +1479,32 @@ func (x *SimpleRequestResponse) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *SimpleRequestResponse) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeNil4706 { + if yyct2 == codecSelferValueTypeNil3232 { *(x) = SimpleRequestResponse{} - } else if yyct2 == codecSelferValueTypeMap4706 { + } else if yyct2 == codecSelferValueTypeMap3232 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { x.codecDecodeSelfFromMap(yyl2, d) } z.DecReadMapEnd() - } else if yyct2 == codecSelferValueTypeArray4706 { + } else if yyct2 == codecSelferValueTypeArray3232 { yyl2 := z.DecReadArrayStart() if yyl2 != 0 { x.codecDecodeSelfFromArray(yyl2, d) } z.DecReadArrayEnd() } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct4706) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct3232) } } func (x *SimpleRequestResponse) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -1583,7 +1579,7 @@ func (x *SimpleRequestResponse) codecDecodeSelfFromMap(l int, d *codec1978.Decod } func (x *SimpleRequestResponse) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r var yyj27 int @@ -1744,7 +1740,7 @@ func (x *SimpleRequestResponse) IsCodecEmpty() bool { func (SimpleEvent) codecSelferViaCodecgen() {} func (x *SimpleEvent) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Encoder(e) _, _, _ = h, z, r if z.EncBasicHandle().CheckCircularRef { @@ -2028,32 +2024,32 @@ func (x *SimpleEvent) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *SimpleEvent) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeNil4706 { + if yyct2 == codecSelferValueTypeNil3232 { *(x) = SimpleEvent{} - } else if yyct2 == codecSelferValueTypeMap4706 { + } else if yyct2 == codecSelferValueTypeMap3232 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { x.codecDecodeSelfFromMap(yyl2, d) } z.DecReadMapEnd() - } else if yyct2 == codecSelferValueTypeArray4706 { + } else if yyct2 == codecSelferValueTypeArray3232 { yyl2 := z.DecReadArrayStart() if yyl2 != 0 { x.codecDecodeSelfFromArray(yyl2, d) } z.DecReadArrayEnd() } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct4706) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct3232) } } func (x *SimpleEvent) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -2091,7 +2087,7 @@ func (x *SimpleEvent) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *SimpleEvent) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r var yyj18 int @@ -2185,7 +2181,7 @@ func (x *SimpleEvent) IsCodecEmpty() bool { func (CRUD) codecSelferViaCodecgen() {} func (x *CRUD) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Encoder(e) _, _, _ = h, z, r if z.EncBasicHandle().CheckCircularRef { @@ -2651,32 +2647,32 @@ func (x *CRUD) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *CRUD) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeNil4706 { + if yyct2 == codecSelferValueTypeNil3232 { *(x) = CRUD{} - } else if yyct2 == codecSelferValueTypeMap4706 { + } else if yyct2 == codecSelferValueTypeMap3232 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { x.codecDecodeSelfFromMap(yyl2, d) } z.DecReadMapEnd() - } else if yyct2 == codecSelferValueTypeArray4706 { + } else if yyct2 == codecSelferValueTypeArray3232 { yyl2 := z.DecReadArrayStart() if yyl2 != 0 { x.codecDecodeSelfFromArray(yyl2, d) } z.DecReadArrayEnd() } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct4706) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct3232) } } func (x *CRUD) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -2751,7 +2747,7 @@ func (x *CRUD) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *CRUD) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r var yyj27 int @@ -2912,7 +2908,7 @@ func (x *CRUD) IsCodecEmpty() bool { func (ServiceRegistration) codecSelferViaCodecgen() {} func (x *ServiceRegistration) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Encoder(e) _, _, _ = h, z, r if z.EncBasicHandle().CheckCircularRef { @@ -2989,32 +2985,32 @@ func (x *ServiceRegistration) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *ServiceRegistration) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeNil4706 { + if yyct2 == codecSelferValueTypeNil3232 { *(x) = ServiceRegistration{} - } else if yyct2 == codecSelferValueTypeMap4706 { + } else if yyct2 == codecSelferValueTypeMap3232 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { x.codecDecodeSelfFromMap(yyl2, d) } z.DecReadMapEnd() - } else if yyct2 == codecSelferValueTypeArray4706 { + } else if yyct2 == codecSelferValueTypeArray3232 { yyl2 := z.DecReadArrayStart() if yyl2 != 0 { x.codecDecodeSelfFromArray(yyl2, d) } z.DecReadArrayEnd() } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct4706) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct3232) } } func (x *ServiceRegistration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -3040,7 +3036,7 @@ func (x *ServiceRegistration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder } func (x *ServiceRegistration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r var yyj8 int @@ -3086,7 +3082,7 @@ func (x *ServiceRegistration) IsCodecEmpty() bool { func (ServiceAlive) codecSelferViaCodecgen() {} func (x *ServiceAlive) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Encoder(e) _, _, _ = h, z, r if z.EncBasicHandle().CheckCircularRef { @@ -3135,32 +3131,32 @@ func (x *ServiceAlive) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *ServiceAlive) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeNil4706 { + if yyct2 == codecSelferValueTypeNil3232 { *(x) = ServiceAlive{} - } else if yyct2 == codecSelferValueTypeMap4706 { + } else if yyct2 == codecSelferValueTypeMap3232 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { x.codecDecodeSelfFromMap(yyl2, d) } z.DecReadMapEnd() - } else if yyct2 == codecSelferValueTypeArray4706 { + } else if yyct2 == codecSelferValueTypeArray3232 { yyl2 := z.DecReadArrayStart() if yyl2 != 0 { x.codecDecodeSelfFromArray(yyl2, d) } z.DecReadArrayEnd() } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct4706) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct3232) } } func (x *ServiceAlive) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -3182,7 +3178,7 @@ func (x *ServiceAlive) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *ServiceAlive) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r var yyj6 int @@ -3212,7 +3208,7 @@ func (x *ServiceAlive) IsCodecEmpty() bool { func (Unknown) codecSelferViaCodecgen() {} func (x *Unknown) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Encoder(e) _, _, _ = h, z, r if z.EncBasicHandle().CheckCircularRef { @@ -3261,32 +3257,32 @@ func (x *Unknown) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *Unknown) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeNil4706 { + if yyct2 == codecSelferValueTypeNil3232 { *(x) = Unknown{} - } else if yyct2 == codecSelferValueTypeMap4706 { + } else if yyct2 == codecSelferValueTypeMap3232 { yyl2 := z.DecReadMapStart() if yyl2 == 0 { } else { x.codecDecodeSelfFromMap(yyl2, d) } z.DecReadMapEnd() - } else if yyct2 == codecSelferValueTypeArray4706 { + } else if yyct2 == codecSelferValueTypeArray3232 { yyl2 := z.DecReadArrayStart() if yyl2 != 0 { x.codecDecodeSelfFromArray(yyl2, d) } z.DecReadArrayEnd() } else { - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct4706) + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct3232) } } func (x *Unknown) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r var yyhl3 bool = l >= 0 @@ -3308,7 +3304,7 @@ func (x *Unknown) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } func (x *Unknown) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer4706 + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r var yyj6 int @@ -3336,8 +3332,8 @@ func (x *Unknown) IsCodecEmpty() bool { return !(x.Type != 0 || false) } -func (x codecSelfer4706) encSliceSlicestring(v [][]string, e *codec1978.Encoder) { - var h codecSelfer4706 +func (x codecSelfer3232) encSliceSlicestring(v [][]string, e *codec1978.Encoder) { + var h codecSelfer3232 z, r := codec1978.GenHelper().Encoder(e) _, _, _ = h, z, r if v == nil { @@ -3356,8 +3352,8 @@ func (x codecSelfer4706) encSliceSlicestring(v [][]string, e *codec1978.Encoder) z.EncWriteArrayEnd() } -func (x codecSelfer4706) decSliceSlicestring(v *[][]string, d *codec1978.Decoder) { - var h codecSelfer4706 +func (x codecSelfer3232) decSliceSlicestring(v *[][]string, d *codec1978.Decoder) { + var h codecSelfer3232 z, r := codec1978.GenHelper().Decoder(d) _, _, _ = h, z, r diff --git a/messagetype_string.go b/messagetype_string.go index 7629c2c..4db234e 100644 --- a/messagetype_string.go +++ b/messagetype_string.go @@ -23,7 +23,7 @@ func _() { _ = x[LastMessageType-12] } -const _MessageType_name = "Invalid0MessageTypeInvalid1MessageTypeAuthorizationMessageTypeSimpleRequestResponseMessageTypeSimpleEventMessageTypeCreateMessageTypeRetrieveMessageTypeUpdateMessageTypeDeleteMessageTypeServiceRegistrationMessageTypeServiceAliveMessageTypeUnknownMessageTypelastMessageType" +const _MessageType_name = "Invalid0MessageTypeInvalid1MessageTypeAuthorizationMessageTypeSimpleRequestResponseMessageTypeSimpleEventMessageTypeCreateMessageTypeRetrieveMessageTypeUpdateMessageTypeDeleteMessageTypeServiceRegistrationMessageTypeServiceAliveMessageTypeUnknownMessageTypeLastMessageType" var _MessageType_index = [...]uint16{0, 19, 38, 62, 94, 116, 133, 152, 169, 186, 216, 239, 257, 272} diff --git a/wrphttp/decoders_test.go b/wrphttp/decoders_test.go index e6f0ea8..ec26e59 100644 --- a/wrphttp/decoders_test.go +++ b/wrphttp/decoders_test.go @@ -6,7 +6,6 @@ package wrphttp import ( "bytes" "context" - "errors" "net/http/httptest" "testing" @@ -112,10 +111,9 @@ func testDecodeEntityBodyError(t *testing.T) { assert = assert.New(t) require = require.New(t) - expectedError = errors.New("failed to decode wrp: EOF") - decoder = DecodeEntity(wrp.Msgpack) - body = bytes.NewReader(nil) - request = httptest.NewRequest("GET", "/", body) + decoder = DecodeEntity(wrp.Msgpack) + body = bytes.NewReader(nil) + request = httptest.NewRequest("GET", "/", body) ) require.NotNil(decoder) @@ -123,7 +121,7 @@ func testDecodeEntityBodyError(t *testing.T) { entity, err := decoder(context.Background(), request) assert.Nil(entity) - assert.Equal(expectedError, err) + assert.Error(err) } func TestDecodeEntity(t *testing.T) {