File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -59,10 +59,17 @@ fmt.Println("Got CID: ", c)
59
59
#### Creating a CID from scratch
60
60
61
61
``` 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
+
62
69
// Create a cid manually by specifying the 'prefix' parameters
63
70
pref := cid.Prefix {
64
71
Version : 1 ,
65
- Codec : cid .Raw ,
72
+ Codec : mc .Raw ,
66
73
MhType : mh.SHA2_256 ,
67
74
MhLength : -1 , // default length
68
75
}
Original file line number Diff line number Diff line change @@ -47,11 +47,12 @@ var (
47
47
ErrInvalidEncoding = errors .New ("invalid base encoding" )
48
48
)
49
49
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>
53
54
const (
54
- // core IPLD
55
+ // common ones
55
56
Raw = 0x55
56
57
DagProtobuf = 0x70 // https://ipld.io/docs/codecs/known/dag-pb/
57
58
DagCBOR = 0x71 // https://ipld.io/docs/codecs/known/dag-cbor/
You can’t perform that action at this time.
0 commit comments