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

proposal: go/format: Use io.Reader and io.Writer interfaces as Source function parameters #56936

edebernis opened this issue Nov 25, 2022 · 2 comments


Copy link

The current Source function accepts []byte array and returns another []byte array.

func Source(src []byte) ([]byte, error)

It would be nice to be able to rely on io.Reader and io.Writer interfaces to format sources.

func SourceStream(w io.Writer, r io.Reader) error

What do you think ?

Thanks !

@gopherbot gopherbot added this to the Proposal milestone Nov 25, 2022
Copy link

mvdan commented Nov 25, 2022

You can already accomplish this via and, for example. I agree that the current APIs aren't perfect, but I'm not sure that more overlapping APIs will help.

Copy link

Thanks ! A little more complex than expected but it does the job ;)

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

No branches or pull requests

3 participants