Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-merkledag
Commits
64bc8442
Unverified
Commit
64bc8442
authored
Aug 07, 2018
by
Steven Allen
Committed by
GitHub
Aug 07, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4 from ipfs/fix/upgrade-protobuf
update gogo protobuf
parents
5d5535f0
4726b1ee
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
1 deletion
+38
-1
coding.go
coding.go
+5
-0
node_test.go
node_test.go
+18
-0
package.json
package.json
+1
-1
pb/merkledag.pb.go
pb/merkledag.pb.go
+9
-0
pb/upgrade_check.go
pb/upgrade_check.go
+5
-0
No files found.
coding.go
View file @
64bc8442
...
...
@@ -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.
...
...
node_test.go
View file @
64bc8442
...
...
@@ -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
{
...
...
package.json
View file @
64bc8442
...
...
@@ -45,7 +45,7 @@
},
{
"author"
:
"whyrusleeping"
,
"hash"
:
"Qm
Z4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV
"
,
"hash"
:
"Qm
e4mBZ8DawL9xJPSzoEnFCHPzEAZ7NTNYoXSqgVBXpXeo
"
,
"name"
:
"gogo-protobuf"
,
"version"
:
"0.0.0"
},
...
...
pb/merkledag.pb.go
View file @
64bc8442
...
...
@@ -31,6 +31,15 @@ import strconv "strconv"
import
bytes
"bytes"
// DoNotUpgradeFileEverItWillChangeYourHashes warns users about not breaking
// their file hashes.
const
DoNotUpgradeFileEverItWillChangeYourHashes
=
`
This file does not produce canonical protobufs. Unfortunately, if we change it,
we'll change the hashes of the files we produce.
Do *not regenerate this file.
`
// Reference imports to suppress errors if they are not otherwise used.
var
_
=
proto
.
Marshal
var
_
=
math
.
Inf
...
...
pb/upgrade_check.go
0 → 100644
View file @
64bc8442
package
merkledag_pb
// Make sure the user doesn't upgrade this package!
// This will fail to build if the user does.
const
_
=
DoNotUpgradeFileEverItWillChangeYourHashes
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment