Skip to content

Commit

Permalink
Merge pull request #4 from ipfs/fix/upgrade-protobuf
Browse files Browse the repository at this point in the history
update gogo protobuf
  • Loading branch information
Stebalien authored Aug 7, 2018
2 parents 5d5535f + 4726b1e commit 64bc844
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
5 changes: 5 additions & 0 deletions coding.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import (
ipld "github.com/ipfs/go-ipld-format"
)

// Make sure the user doesn't upgrade this file.
// We need to check *here* as well as inside the `pb` package *just* in case the
// user replaces *all* go files in that package.
const _ = pb.DoNotUpgradeFileEverItWillChangeYourHashes

// for now, we use a PBNode intermediate thing.
// because native go objects are nice.

Expand Down
18 changes: 18 additions & 0 deletions node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,26 @@ import (
mdtest "github.com/ipfs/go-merkledag/test"

ipld "github.com/ipfs/go-ipld-format"
cid "github.com/ipfs/go-cid"
)

func TestStableCID(t *testing.T) {
nd := &ProtoNode{}
nd.SetData([]byte("foobar"))
nd.SetLinks([]*ipld.Link{
{Name: "a"},
{Name: "b"},
{Name: "c"},
})
expected, err := cid.Decode("QmSN3WED2xPLbYvBbfvew2ZLtui8EbFYYcbfkpKH5jwG9C")
if err != nil {
t.Fatal(err)
}
if !nd.Cid().Equals(expected) {
t.Fatalf("Got CID %s, expected CID %s", nd.Cid(), expected)
}
}

func TestRemoveLink(t *testing.T) {
nd := &ProtoNode{}
nd.SetLinks([]*ipld.Link{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
{
"author": "whyrusleeping",
"hash": "QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV",
"hash": "Qme4mBZ8DawL9xJPSzoEnFCHPzEAZ7NTNYoXSqgVBXpXeo",
"name": "gogo-protobuf",
"version": "0.0.0"
},
Expand Down
9 changes: 9 additions & 0 deletions pb/merkledag.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pb/upgrade_check.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package merkledag_pb

// Make sure the user doesn't upgrade this package!
// This will fail to build if the user does.
const _ = DoNotUpgradeFileEverItWillChangeYourHashes

0 comments on commit 64bc844

Please sign in to comment.