-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a new Encode method that is like StringOfBase but never errors #60
Conversation
5768359
to
990a524
Compare
9e889ff
to
70097b5
Compare
CC: @Stebalien for review. |
cid.go
Outdated
@@ -337,6 +337,19 @@ func (c *Cid) StringOfBase(base mbase.Encoding) (string, error) { | |||
} | |||
} | |||
|
|||
// Encode return the string representation of a Cid in a given base | |||
// when applicable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd definitely expand on the edge cases here. Other than that, I have no real objections if we end up needing this.
70097b5
to
b3d85b3
Compare
@Stebalien this will end up being useful. If we are going to push #71 though in the next couple of days I would like to get this in also. |
We should probably also deprecate |
The idea is that we can just replace calls to
String()
withEncode(base)
. For this to work we need a method that will return meaningful results for all CIDs and never errors.Used by ipfs/kubo#5289.