Skip to content

Conversation

@kevina
Copy link
Contributor

@kevina kevina commented Jul 26, 2018

The idea is that we can just replace calls to String() with Encode(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.

@ghost ghost assigned kevina Jul 26, 2018
@ghost ghost added the status/in-progress In progress label Jul 26, 2018
@kevina kevina force-pushed the kevina/cid-fmtb branch 2 times, most recently from 5768359 to 990a524 Compare July 27, 2018 22:03
@kevina kevina changed the title Create a new Format method that is like StringOfBase but never errors Create a new Encode method that is like StringOfBase but never errors Aug 1, 2018
@kevina kevina requested a review from Stebalien August 1, 2018 08:38
@kevina kevina mentioned this pull request Aug 1, 2018
@kevina kevina force-pushed the kevina/cid-fmtb branch 3 times, most recently from 9e889ff to 70097b5 Compare August 1, 2018 22:59
@kevina
Copy link
Contributor Author

kevina commented Aug 2, 2018

CC: @Stebalien for review.

@kevina kevina changed the title Create a new Encode method that is like StringOfBase but never errors WIP: Create a new Encode method that is like StringOfBase but never errors Aug 7, 2018
cid.go Outdated
}

// Encode return the string representation of a Cid in a given base
// when applicable
Copy link
Member

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.

@kevina kevina changed the title WIP: Create a new Encode method that is like StringOfBase but never errors Create a new Encode method that is like StringOfBase but never errors Aug 30, 2018
@kevina
Copy link
Contributor Author

kevina commented Aug 30, 2018

@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.

@Stebalien Stebalien merged commit 6ddb575 into master Aug 30, 2018
@ghost ghost removed the status/in-progress In progress label Aug 30, 2018
@Stebalien Stebalien deleted the kevina/cid-fmtb branch August 30, 2018 23:07
@Stebalien
Copy link
Member

We should probably also deprecate StringOfBase eventually, but this is good for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants