explicitly throw away impossible write errors

This commit is contained in:
Steven Allen 2018-06-22 14:31:41 -07:00
parent 1e80322cf0
commit 1fc094e0e0

View File

@ -26,7 +26,7 @@ func stringToBytes(s string) ([]byte, error) {
if p.Code == 0 { if p.Code == 0 {
return nil, fmt.Errorf("no protocol with name %s", sp[0]) return nil, fmt.Errorf("no protocol with name %s", sp[0])
} }
b.Write(CodeToVarint(p.Code)) _, _ = b.Write(CodeToVarint(p.Code))
sp = sp[1:] sp = sp[1:]
if p.Size == 0 { // no length. if p.Size == 0 { // no length.
@ -51,7 +51,7 @@ func stringToBytes(s string) ([]byte, error) {
return nil, fmt.Errorf("failed to parse %s: %s %s", p.Name, sp[0], err) return nil, fmt.Errorf("failed to parse %s: %s %s", p.Name, sp[0], err)
} }
if p.Size < 0 { // varint size. if p.Size < 0 { // varint size.
b.Write(CodeToVarint(len(a))) _, _ = b.Write(CodeToVarint(len(a)))
} }
b.Write(a) b.Write(a)
sp = sp[1:] sp = sp[1:]