Skip to content
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

Remove pretty-printing #202

Merged
merged 4 commits into from
Jul 16, 2021
Merged

Remove pretty-printing #202

merged 4 commits into from
Jul 16, 2021

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Jul 14, 2021

but .. this is only part of the story, because we still have map key ordering "problems"

@rvagg rvagg requested a review from warpfork July 14, 2021 02:41
This CID has not been verified - dag-json w/ sha2-512 capped at 4 bytes for
a block that's non-trivial to reconstruct manually.
@@ -318,7 +318,7 @@ func TestFocusedTransformWithLinks(t *testing.T) {
Wish(t, progress.Path.String(), ShouldEqual, "linkedMap/nested/nonlink")
Wish(t, must.String(prev), ShouldEqual, "zoo")
Wish(t, progress.LastBlock.Path.String(), ShouldEqual, "linkedMap")
Wish(t, progress.LastBlock.Link.String(), ShouldEqual, "baguqeeyevmbz3ga")
Wish(t, progress.LastBlock.Link.String(), ShouldEqual, "baguqeeye2opztzy")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty uncomfortable about changing this without verifying the block encodes to this CID, but the fixture is complicated enough that I'm not keen to reconstruct it for a one-off verification unless this arises out of some previously constructed fixture.

Copy link
Contributor

@mvdan mvdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I've wanted this for some time.

You could also simplify the bindnode examples, which explicitly set refmt parameters to disable pretty-printing: https://pkg.go.dev/github.com/ipld/go-ipld-prime@master/node/bindnode#example-Prototype-OnlySchema

I think those could now use the default behavior.

codec/dagjson/multicodec.go Outdated Show resolved Hide resolved
@rvagg
Copy link
Member Author

rvagg commented Jul 15, 2021

@mvdan can you have a look at 89258dd please as I've simplified a few places where refmt was previously used. It's not clear why it was used in a couple of those places and maybe I've overstepped by undoing those too.

@mvdan
Copy link
Contributor

mvdan commented Jul 15, 2021

@rvagg LGTM, looks amazing 💌

@mvdan
Copy link
Contributor

mvdan commented Jul 15, 2021

It's not clear why it was used in a couple of those places and maybe I've overstepped by undoing those too.

As far as I can tell, using refmt explicitly is only to supply non-default options, which only matters for the encoding pretty-printing. So I'm pretty sure it's a no-op to remove empty refmt options from decodes. And for the encodes you're changing the default to not pretty-print, so that also looks like a no-op change to me.

@rvagg rvagg merged commit fc47eb2 into master Jul 16, 2021
@rvagg rvagg deleted the rvagg/pretty-print-no branch July 16, 2021 03:24
@warpfork
Copy link
Collaborator

👍 to seeing less of refmt -- I'm wholeheartedly in favor of change in that direction. Most (all?) of the places it appears were punts where I didn't have a better plan at the time.

If we do get into working on configurability patterns for ipld codecs, I'd like to not have any refmt symbols appear in them. There's just no reason to have codec configurability cause the user's attention to get stretched out across repos if we can help it.

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