go-ipld-prime icon indicating copy to clipboard operation
go-ipld-prime copied to clipboard

switch hard-coded multicodec constants to go-multicodec

Open mvdan opened this issue 3 years ago • 0 comments

For example, the codec packages use 0xNN literals when registering themselves as encoders and decoders.

We have https://pkg.go.dev/github.com/multiformats/go-multicodec now, so we might as well start using it.

There's also the question of whether https://pkg.go.dev/github.com/ipld/[email protected]/linking/cid#RegisterMulticodecDecoder and others could swap the uint64 argument for multicodec.Code. I think the answer is "yes", because most existing users are using untyped constants like 0x55, meaning that in practice very few programs should break. And one can argue we should encourage the use of the named constants, anyway.

mvdan avatar Mar 05 '21 15:03 mvdan