Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

update gogo protobuf #6

Merged
merged 3 commits into from
Aug 9, 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
2 changes: 1 addition & 1 deletion .gx/lastpubver
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.4: QmVxjT67BU1QZUPzSLNZT6DkDzVNfPfkzqNyJYFXxSH2hA
1.0.5: QmYaUq9tSbWNzaVMVAMeP4CV9iQ4bWoefetfYS9H5GF2o6
37 changes: 36 additions & 1 deletion importer/importer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import (
"io/ioutil"
"testing"

mdtest "github.com/ipfs/go-merkledag/test"
uio "github.com/ipfs/go-unixfs/io"

cid "github.com/ipfs/go-cid"
chunker "github.com/ipfs/go-ipfs-chunker"
u "github.com/ipfs/go-ipfs-util"
ipld "github.com/ipfs/go-ipld-format"
mdtest "github.com/ipfs/go-merkledag/test"
)

func getBalancedDag(t testing.TB, size int64, blksize int64) (ipld.Node, ipld.DAGService) {
Expand All @@ -35,6 +36,40 @@ func getTrickleDag(t testing.TB, size int64, blksize int64) (ipld.Node, ipld.DAG
return nd, ds
}

func TestStableCid(t *testing.T) {
ds := mdtest.Mock()
buf := make([]byte, 10 * 1024 * 1024)
u.NewSeededRand(0xdeadbeef).Read(buf)
r := bytes.NewReader(buf)

nd, err := BuildDagFromReader(ds, chunker.DefaultSplitter(r))
if err != nil {
t.Fatal(err)
}

expected, err := cid.Decode("QmZN1qquw84zhV4j6vT56tCcmFxaDaySL1ezTXFvMdNmrK")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passes on both this branch and master.

if err != nil {
t.Fatal(err)
}
if !expected.Equals(nd.Cid()) {
t.Fatalf("expected CID %s, got CID %s", expected, nd)
}

dr, err := uio.NewDagReader(context.Background(), nd, ds)
if err != nil {
t.Fatal(err)
}

out, err := ioutil.ReadAll(dr)
if err != nil {
t.Fatal(err)
}

if !bytes.Equal(out, buf) {
t.Fatal("bad read")
}
}

func TestBalancedDag(t *testing.T) {
ds := mdtest.Mock()
buf := make([]byte, 10000)
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
},
{
"author": "why",
"hash": "QmfKKGzisaoP4oiHQSHz1zLbXDCTeXe7NVfX1FAMKzcHmt",
"hash": "QmeVFsd5aE3U2N9ivM7MniNynZA82RqCgEMEpDgTowCnHK",
"name": "go-merkledag",
"version": "1.0.4"
"version": "1.0.5"
},
{
"author": "hector",
Expand Down Expand Up @@ -62,7 +62,7 @@
},
{
"author": "whyrusleeping",
"hash": "QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV",
"hash": "QmdxUuburamoF6zF9qjeQC4WYcWGbWuRmdLacMEsW8ioD8",
"name": "gogo-protobuf",
"version": "0.0.0"
},
Expand All @@ -78,6 +78,6 @@
"license": "",
"name": "go-unixfs",
"releaseCmd": "git commit -a -m \"gx publish $VERSION\"",
"version": "1.0.4"
"version": "1.0.5"
}

11 changes: 11 additions & 0 deletions pb/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
PB = $(wildcard *.proto)
GO = $(PB:.proto=.pb.go)

all: $(GO)

%.pb.go: %.proto
protoc --proto_path=$(GOPATH)/src:. --gogo_out=. $<

clean:
rm -f *.pb.go
rm -f *.go
8 changes: 0 additions & 8 deletions pb/Rules.mk

This file was deleted.

106 changes: 85 additions & 21 deletions pb/unixfs.pb.go

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

2 changes: 2 additions & 0 deletions pb/unixfs.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
syntax = "proto2";

package unixfs.pb;

message Data {
Expand Down