Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update gogo protobuf #4

Merged
merged 3 commits into from
Aug 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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