Skip to content

Commit

Permalink
Rename Format method to Encode.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevina committed Aug 1, 2018
1 parent 8fd9ae9 commit d96991e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions cid.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,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 {
// Enccode 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()
Expand Down
4 changes: 2 additions & 2 deletions cid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit d96991e

Please sign in to comment.