Skip to content

Commit

Permalink
Use lookup table in go-multibase now that it is supported.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevina committed Jul 27, 2018
1 parent dc74391 commit 5768359
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cid-fmt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,11 @@ func fmtCid(fmtStr string, base mb.Encoding, cid *c.Cid) (string, error) {
}

func baseToString(base mb.Encoding) string {
// FIXME: Use lookup tables when they are added to go-multibase
switch base {
case mb.Base58BTC:
return "base58btc"
default:
baseStr, ok := mb.EncodingToStr[base]
if !ok {
return fmt.Sprintf("base?%c", base)
}
return baseStr
}

func codecToString(num uint64) string {
Expand Down

0 comments on commit 5768359

Please sign in to comment.