1
0
mirror of https://github.com/libp2p/go-libp2p-core.git synced 2025-04-28 17:10:14 +08:00

refactor: use %q for invalid codes

Co-authored-by: Daniel Martí <mvdan@mvdan.cc>
This commit is contained in:
Marcin Rataj 2022-03-31 15:58:09 +02:00 committed by GitHub
parent d9f3ebc01c
commit fcd80a7e50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -165,7 +165,7 @@ func Encode(id ID) string {
func FromCid(c cid.Cid) (ID, error) {
code := mc.Code(c.Type())
if code != mc.Libp2pKey {
return "", fmt.Errorf("can't convert CID of type %s to a peer ID", code.String())
return "", fmt.Errorf("can't convert CID of type %q to a peer ID", code)
}
return ID(c.Hash()), nil
}