-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Description
https://github.com/ipfs/go-cid/pull/137/files is removing hardcoded mapping tables from go-cid,
and we need a replacement for people who will be migrating to go-multicodec
I want to document the best way way of doing string → code and code → string
My understanding is that:
Old way (go-cid)
cid "github.com/ipfs/go-cid"
// string → code
code := cid.Codecs["libp2p-key"]
// code → string
string := cid.CodecToStr[code]New way (go-multicodec)
mc "github.com/multiformats/go-multicodec"
// string → code
var mc.Code code
code.Set("libp2p-key")
// code → string
code.String()@mvdan any thoughts if this is good enough?
Should we add StrToCodec and CodecToStr maps to go-multicodec, or is it not worth it?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels