diff --git a/cid.go b/cid.go index 00775af..76e7b55 100644 --- a/cid.go +++ b/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() diff --git a/cid_test.go b/cid_test.go index 3a6db4b..2d4c297 100644 --- a/cid_test.go +++ b/cid_test.go @@ -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) }