You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This program prints "gob: encodeArray: nil element".
Nil pointers are allowed in structs; why not in arrays?
type X struct {
I int
}
func main() {
enc := gob.NewEncoder(new(bytes.Buffer))
err := enc.Encode([]*X{&X{99}, nil})
fmt.Println(err)
}
The text was updated successfully, but these errors were encountered:
There are no pointers in the encoding, so the best it could do without an encoding
change is a zero value for the object, which is not the same thing. It's not clear to
me what the right answer would be.
The text was updated successfully, but these errors were encountered: