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
gob should be able to encode types that contain chans and functions, so long as those
fields are not exported.
-------------
package main
import (
"encoding/gob"
"bytes"
)
type Foo struct {
A int
b chan int
}
func main() {
f := Foo{}
var stream bytes.Buffer
enc := gob.NewEncoder(&stream)
err := enc.Encode(f)
if err != nil {
println(err.Error())
return
}
}
-------------
gob fails to encode in the above program with the error "gob: can't encode type
chan int". Because gob isn't going to encode the field b anyway, because it is
unexported, the fact that it is a channel should not cause an error.
Compiler: 6g
OS: OSX 10.6.8
hg id: fb1cf5563774 tip
The text was updated successfully, but these errors were encountered:
by runningwild:
The text was updated successfully, but these errors were encountered: