io: add support for pointer receivers in WriteArray()
It's actually preferable to have pointer receivers for serializable types, so this should be supported.
This commit is contained in:
parent
052ba1e94f
commit
b542a5e7a0
2 changed files with 26 additions and 1 deletions
|
@ -49,7 +49,10 @@ func (w *BinWriter) WriteArray(arr interface{}) {
|
|||
for i := 0; i < val.Len(); i++ {
|
||||
el, ok := val.Index(i).Interface().(encodable)
|
||||
if !ok {
|
||||
panic(typ.String() + "is not encodable")
|
||||
el, ok = val.Index(i).Addr().Interface().(encodable)
|
||||
if !ok {
|
||||
panic(typ.String() + " is not encodable")
|
||||
}
|
||||
}
|
||||
|
||||
el.EncodeBinary(w)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue