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

go-golden should support pretty-printed golden files #4

Open
vsinha opened this issue Aug 3, 2022 · 3 comments
Open

go-golden should support pretty-printed golden files #4

vsinha opened this issue Aug 3, 2022 · 3 comments

Comments

@vsinha
Copy link

vsinha commented Aug 3, 2022

Hi jimeh, have you thought about supporting something like json.Indent for updated golden files? It would make them cleaner to read manually, which I think would be a nice thing to have.

Excited about this library!

@jimeh
Copy link
Owner

jimeh commented Aug 3, 2022

I believe what is written to golden files is actually outside the scope of the golden package itself, as it just reads/writes byte slices.

But I have been on and off working on a companion package that has assertion helpers for JSON, YAML, and XML. Along with a means for supplying custom marshal/unmarshal functions for any kind of wire format.

I can't promise a timeline, but I want to get it finished "soon", as it would replace and simplify nearly all of my own current uses of the golden package.

@vsinha
Copy link
Author

vsinha commented Aug 3, 2022

That makes sense. I wrote up a helper function for my json-specific application, is this the kind of thing you had in mind?

Just getting started with Go / getting a lay of the land wrt libraries and best practices

@jimeh
Copy link
Owner

jimeh commented Aug 3, 2022

Yep, that's roughly the kind of thing I'm doing myself for structs that serialized to JSON/YAML/XML.

And the companion package I'm working on will do that, but lots of flexibility :)

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

No branches or pull requests

2 participants