Skip to content

Commit

Permalink
gx update and fix code to use new Cid type
Browse files Browse the repository at this point in the history
  • Loading branch information
kevina committed Sep 11, 2018
1 parent 2b2e003 commit 1084e5f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions node.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ type Node struct {
tree []string
links []*node.Link
raw []byte
cid *cid.Cid
cid cid.Cid
}

func WrapObject(m interface{}, mhType uint64, mhLen int) (*Node, error) {
Expand Down Expand Up @@ -170,14 +170,14 @@ func (n *Node) Resolve(path []string) (interface{}, []string, error) {
}

cur = curv[n]
case *cid.Cid:
case cid.Cid:
return &node.Link{Cid: curv}, path[i:], nil
default:
return nil, nil, errors.New("tried to resolve through object that had no links")
}
}

lnk, ok := cur.(*cid.Cid)
lnk, ok := cur.(cid.Cid)
if ok {
return &node.Link{Cid: lnk}, nil, nil
}
Expand Down Expand Up @@ -309,7 +309,7 @@ func (n *Node) Links() []*node.Link {
func compLinks(obj interface{}) ([]*node.Link, error) {
var out []*node.Link
err := traverse(obj, "", func(name string, val interface{}) error {
if lnk, ok := val.(*cid.Cid); ok {
if lnk, ok := val.(cid.Cid); ok {
out = append(out, &node.Link{Cid: lnk})
}
return nil
Expand Down Expand Up @@ -367,7 +367,7 @@ func DumpObject(obj interface{}) ([]byte, error) {
return buf.Bytes(), nil
}

func (n *Node) Cid() *cid.Cid {
func (n *Node) Cid() cid.Cid {
return n.cid
}

Expand Down Expand Up @@ -514,7 +514,7 @@ func convertToCborIshObj(i interface{}) (interface{}, error) {
}

func EncoderFilter(i interface{}) interface{} {
link, ok := i.(*cid.Cid)
link, ok := i.(cid.Cid)
if !ok {
return i
}
Expand Down
4 changes: 2 additions & 2 deletions node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
mh "github.com/multiformats/go-multihash"
)

func assertCid(c *cid.Cid, exp string) error {
func assertCid(c cid.Cid, exp string) error {
if c.String() != exp {
return fmt.Errorf("expected cid of %s, got %s", exp, c)
}
Expand Down Expand Up @@ -298,7 +298,7 @@ func TestFromJson(t *testing.T) {
t.Fatal(err)
}

c, ok := n.obj.(map[interface{}]interface{})["something"].(*cid.Cid)
c, ok := n.obj.(map[interface{}]interface{})["something"].(cid.Cid)
if !ok {
t.Fatal("expected a cid")
}
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"gxDependencies": [
{
"author": "whyrusleeping",
"hash": "QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC",
"hash": "QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL",
"name": "go-ipld-format",
"version": "0.5.8"
"version": "0.6.0"
},
{
"author": "whyrusleeping",
"hash": "QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb",
"hash": "QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7",
"name": "go-cid",
"version": "0.8.0"
"version": "0.9.0"
},
{
"author": "whyrusleeping",
Expand All @@ -33,9 +33,9 @@
},
{
"author": "stebalien",
"hash": "QmWAzSEoqZ6xU6pu8yL8e5WaMb7wtbfbhhN4p1DknUPtr3",
"hash": "QmRcHuYzAyswytBuMF78rj3LTChYszomRFXNg4685ZN1WM",
"name": "go-block-format",
"version": "0.1.11"
"version": "0.2.0"
},
{
"author": "multiformats",
Expand Down

0 comments on commit 1084e5f

Please sign in to comment.