Skip to content

Commit 3ac35ce

Browse files
committed
Encode now returns an error
1 parent 723bf73 commit 3ac35ce

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

v3.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,23 @@ func NewV3Encoder(out v3.Writer, isStream bool) *V3Encoder {
3535
}
3636

3737
//Encodev3 encodes an `interface{}`` into a bytebuffer using ttv3
38-
func Encodev3(d interface{}, out v3.Writer) {
38+
func Encodev3(d interface{}, out v3.Writer) error {
3939
out.Write(v3NoStreamHeader)
4040

4141
enc := &V3Encoder{
4242
out: out,
4343
varintbuf: &[binary.MaxVarintLen64]byte{},
4444
}
4545
//We dont have to lock/unlock since we know we are the only one witha acces
46-
enc.encodeValuev3(d, v3.Key{})
46+
return enc.encodeValuev3(d, v3.Key{})
4747
}
4848

4949
//Encode encodes an `interface{}`` into a bytebuffer using ttv3
50-
func (enc *V3Encoder) Encode(d interface{}) {
50+
func (enc *V3Encoder) Encode(d interface{}) error {
5151
enc.Lock()
52-
enc.encodeValuev3(d, v3.Key{})
52+
ret := enc.encodeValuev3(d, v3.Key{})
5353
enc.Unlock()
54+
return ret
5455
}
5556

5657
func encodeKeyv3(k interface{}) v3.Key {

0 commit comments

Comments
 (0)