Skip to content

Commit 85198b9

Browse files
committed
docs: point people at go-multicodec
1 parent 6ca2617 commit 85198b9

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,17 @@ fmt.Println("Got CID: ", c)
5959
#### Creating a CID from scratch
6060

6161
```go
62+
63+
import (
64+
cid "github.com/ipfs/go-cid"
65+
mc "github.com/multiformats/go-multicodec"
66+
mh "github.com/multiformats/go-multihash"
67+
)
68+
6269
// Create a cid manually by specifying the 'prefix' parameters
6370
pref := cid.Prefix{
6471
Version: 1,
65-
Codec: cid.Raw,
72+
Codec: mc.Raw,
6673
MhType: mh.SHA2_256,
6774
MhLength: -1, // default length
6875
}

cid.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ var (
4747
ErrInvalidEncoding = errors.New("invalid base encoding")
4848
)
4949

50-
// These are multicodec-packed content types. The should match
51-
// the codes described in the authoritative document:
52-
// https://github.com/multiformats/multicodec/blob/master/table.csv
50+
// Consts below are DEPRECATED and left only for legacy reasons:
51+
// <https://github.com/ipfs/go-cid/pull/137>
52+
// Modern code should use consts from go-multicodec instead:
53+
// <https://github.com/multiformats/go-multicodec>
5354
const (
54-
// core IPLD
55+
// common ones
5556
Raw = 0x55
5657
DagProtobuf = 0x70 // https://ipld.io/docs/codecs/known/dag-pb/
5758
DagCBOR = 0x71 // https://ipld.io/docs/codecs/known/dag-cbor/

0 commit comments

Comments
 (0)