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:
parent
d9f3ebc01c
commit
fcd80a7e50
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user