diff --git a/src/pkg/gob/encoder.go b/src/pkg/gob/encoder.go index 308c58d303..3d217e2720 100644 --- a/src/pkg/gob/encoder.go +++ b/src/pkg/gob/encoder.go @@ -173,8 +173,12 @@ func (enc *Encoder) Encode(e interface{}) os.Error { encodeInt(enc.state, int64(enc.sent[rt])) // Encode the object. - encode(enc.state.b, e) - enc.send() + err := encode(enc.state.b, e) + if err != nil { + enc.setError(err) + } else { + enc.send() + } return enc.state.err }