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

container: add a helper for test only #108

Merged
merged 1 commit into from
Feb 27, 2025
Merged

container: add a helper for test only #108

merged 1 commit into from
Feb 27, 2025

Conversation

MichaelMure
Copy link
Collaborator

No description provided.

@@ -120,3 +120,20 @@ func (ctn Writer) toWriter(header header, w io.Writer) (err error) {

return ipld.EncodeStreaming(encoder, node, cbor.Encode)
}

// ToReader convert a container Writer into a Reader.
// Most likely, you only want to use this in tests for convenience.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Most likely

Since it's not a test package, shouldn't we just return (io.Reader, error) and let the user decide?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's to a Reader, not an io.Reader.
There is really no reason to use those beside test where you do odd things. Otherwise you are only on the "writing" side or the "reading" side.

@MichaelMure MichaelMure merged commit a82bce5 into main Feb 27, 2025
6 checks passed
@MichaelMure MichaelMure deleted the cont-test branch February 27, 2025 14:00
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.

2 participants