@@ -41,7 +41,7 @@ func newDefaultStructCodec() *StructCodec {
4141 if err != nil {
4242 // This function is called from the codec registration path, so errors can't be propagated. If there's an error
4343 // constructing the StructCodec, we panic to avoid losing it.
44- panic (fmt .Errorf ("error creating default StructCodec: %v " , err ))
44+ panic (fmt .Errorf ("error creating default StructCodec: %w " , err ))
4545 }
4646 return codec
4747}
@@ -178,7 +178,7 @@ func (dvd DefaultValueDecoders) DDecodeValue(dc DecodeContext, vr bsonrw.ValueRe
178178
179179 for {
180180 key , elemVr , err := dr .ReadElement ()
181- if err == bsonrw .ErrEOD {
181+ if errors . Is ( err , bsonrw .ErrEOD ) {
182182 break
183183 } else if err != nil {
184184 return err
@@ -1379,7 +1379,7 @@ func (dvd DefaultValueDecoders) MapDecodeValue(dc DecodeContext, vr bsonrw.Value
13791379 keyType := val .Type ().Key ()
13801380 for {
13811381 key , vr , err := dr .ReadElement ()
1382- if err == bsonrw .ErrEOD {
1382+ if errors . Is ( err , bsonrw .ErrEOD ) {
13831383 break
13841384 }
13851385 if err != nil {
@@ -1675,7 +1675,7 @@ func (dvd DefaultValueDecoders) decodeDefault(dc DecodeContext, vr bsonrw.ValueR
16751675 idx := 0
16761676 for {
16771677 vr , err := ar .ReadValue ()
1678- if err == bsonrw .ErrEOA {
1678+ if errors . Is ( err , bsonrw .ErrEOA ) {
16791679 break
16801680 }
16811681 if err != nil {
0 commit comments