From 6f524a43801ba3b5832fdce54e01cc8293fd115d Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Fri, 14 Dec 2018 19:37:13 +1100 Subject: [PATCH] Use the original protocol name for address missing errors Reduces confusion due to aliased protocol names. License: MIT Signed-off-by: Matt Joiner --- codec.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/codec.go b/codec.go index 6234f6e..3ffb748 100644 --- a/codec.go +++ b/codec.go @@ -22,7 +22,8 @@ func stringToBytes(s string) ([]byte, error) { sp = sp[1:] for len(sp) > 0 { - p := ProtocolWithName(sp[0]) + name := sp[0] + p := ProtocolWithName(name) if p.Code == 0 { return nil, fmt.Errorf("no protocol with name %s", sp[0]) } @@ -34,7 +35,7 @@ func stringToBytes(s string) ([]byte, error) { } if len(sp) < 1 { - return nil, fmt.Errorf("protocol requires address, none given: %s", p.Name) + return nil, fmt.Errorf("protocol requires address, none given: %s", name) } if p.Path {