Rename Format method to Encode.
This commit is contained in:
5
cid.go
5
cid.go
@@ -338,8 +338,9 @@ func (c *Cid) StringOfBase(base mbase.Encoding) (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Format return the string representation of a Cid
|
||||
func (c *Cid) Format(base mbase.Encoder) string {
|
||||
// Encode return the string representation of a Cid in a given base
|
||||
// when applicable
|
||||
func (c *Cid) Encode(base mbase.Encoder) string {
|
||||
switch c.version {
|
||||
case 0:
|
||||
return c.hash.B58String()
|
||||
|
||||
@@ -153,11 +153,11 @@ func TestBasesMarshaling(t *testing.T) {
|
||||
|
||||
assertEqual(t, cid, out2)
|
||||
|
||||
prefix, err := mbase.NewEncoder(b)
|
||||
encoder, err := mbase.NewEncoder(b)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s2 := cid.Format(prefix)
|
||||
s2 := cid.Encode(encoder)
|
||||
if s != s2 {
|
||||
t.Fatalf("'%s' != '%s'", s, s2)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user