mirror of
https://github.com/logos-messaging/go-multiaddr.git
synced 2026-01-03 21:43:06 +00:00
explicitly throw away impossible write errors
This commit is contained in:
parent
1e80322cf0
commit
1fc094e0e0
4
codec.go
4
codec.go
@ -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:]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user