Rename Format method to Encode.

This commit is contained in:
Kevin Atkinson
2018-08-01 15:34:58 -04:00
parent a0b3b11e63
commit 9091e50b29
2 changed files with 5 additions and 4 deletions

5
cid.go
View File

@@ -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()

View File

@@ -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)
}