1
0
mirror of https://github.com/golang/go synced 2024-11-20 06:14:53 -07:00

gob: bug fix: errors encoding the payload were not

returned to caller.

R=rsc
CC=golang-dev
https://golang.org/cl/1164041
This commit is contained in:
Rob Pike 2010-05-07 13:30:13 -07:00
parent 56c5710b38
commit b541921b66

View File

@ -173,8 +173,12 @@ func (enc *Encoder) Encode(e interface{}) os.Error {
encodeInt(enc.state, int64(enc.sent[rt])) encodeInt(enc.state, int64(enc.sent[rt]))
// Encode the object. // Encode the object.
encode(enc.state.b, e) err := encode(enc.state.b, e)
enc.send() if err != nil {
enc.setError(err)
} else {
enc.send()
}
return enc.state.err return enc.state.err
} }