Commit 77c80001 authored by Mildred Ki'Lya's avatar Mildred Ki'Lya

merkledag: Make Node.Unmarshal() private

License: MIT
Signed-off-by: default avatarMildred Ki'Lya <mildred-pub.git@mildred.fr>
parent f63bfe0a
...@@ -13,9 +13,9 @@ import ( ...@@ -13,9 +13,9 @@ import (
// for now, we use a PBNode intermediate thing. // for now, we use a PBNode intermediate thing.
// because native go objects are nice. // because native go objects are nice.
// Unmarshal decodes raw data into a *Node instance. // unmarshal decodes raw data into a *Node instance.
// The conversion uses an intermediate PBNode. // The conversion uses an intermediate PBNode.
func (n *Node) Unmarshal(encoded []byte) error { func (n *Node) unmarshal(encoded []byte) error {
var pbn pb.PBNode var pbn pb.PBNode
if err := pbn.Unmarshal(encoded); err != nil { if err := pbn.Unmarshal(encoded); err != nil {
return fmt.Errorf("Unmarshal failed. %v", err) return fmt.Errorf("Unmarshal failed. %v", err)
...@@ -87,7 +87,7 @@ func (n *Node) Encoded(force bool) ([]byte, error) { ...@@ -87,7 +87,7 @@ func (n *Node) Encoded(force bool) ([]byte, error) {
// Decoded decodes raw data and returns a new Node instance. // Decoded decodes raw data and returns a new Node instance.
func Decoded(encoded []byte) (*Node, error) { func Decoded(encoded []byte) (*Node, error) {
n := new(Node) n := new(Node)
err := n.Unmarshal(encoded) err := n.unmarshal(encoded)
if err != nil { if err != nil {
return nil, fmt.Errorf("incorrectly formatted merkledag node: %s", err) return nil, fmt.Errorf("incorrectly formatted merkledag node: %s", err)
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment