-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
In GODRIVER-1356, we allowed a pointer to a type to implement the hooks we check for during BSON encoding/decoding (e.g. bsoncodec.Marshaler). This causes problems if the value being marshalled isn't addressable but a pointer to the value implements the hook. The registry will return the codec for the hook, but the codec will error because val.CanAddr returns false. See https://play.golang.org/p/GwmqXl5sFAx for a repro.
As a side-note, I don't really understand why the value isn't addressable. Unfortunately, the registry does lookups using reflect.Type so it doesn't have enough information to know if the value is addressable or not.