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

format slice and maps of float #399

Closed

Conversation

edwinwijaya94
Copy link
Contributor

Closes #258

formatter.go Outdated

if arr, ok := value.([]interface{}); ok {
for k, v := range arr {
arr[k] = f.formatValue(v)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @gavv this is a WIP PR, I want to discuss first before continue.
So, I was thinking to handle nested slice / maps of floats by doing recursive call.
Example: [[1.0, 2.0, 3.0]] or ["a": [1.0, 2.0], "b": {"b1": [3.0, 4.0]}]

WDYT?

Copy link
Owner

Choose a reason for hiding this comment

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

Makes sense

@gavv gavv added the work in progress Pull request is still in progress and changing label Apr 11, 2023
@edwinwijaya94 edwinwijaya94 marked this pull request as ready for review April 15, 2023 12:03
@gavv gavv added ready for review Pull request can be reviewed and removed work in progress Pull request is still in progress and changing labels Apr 22, 2023
@gavv
Copy link
Owner

gavv commented Apr 22, 2023

Thanks for update, will review in upcoming days. Please fix tests and linter errors as reported by CI.

@gavv gavv added the needs revision Pull request should be revised by its author label Apr 22, 2023
@edwinwijaya94 edwinwijaya94 force-pushed the i_edwin_float_formatter branch from 77e35d3 to 7878c76 Compare May 6, 2023 07:56
@edwinwijaya94
Copy link
Contributor Author

Hi @gavv, it's ready for review now.
However, I have one doubt related with the unit tests. Some of them are broken due to escaped string format, and I have fixed it on this commit 7878c76. Need you review whether it's the correct approach.
Thanks

@gavv gavv removed the needs revision Pull request should be revised by its author label May 15, 2023
@gavv
Copy link
Owner

gavv commented Oct 7, 2023

Hi, thanks for PR and sorry for delay.

As you correctly mentioned, this patch breaks a lot of things and the implementation looks very strange, because it drops json.MarshalIndent, but does not provide a proper alternative.

I was thinking how it could be implemented properly and I think I found a solution. I've created a new task for it, and will close current issue with regards to the new one.

See here: #430

I think it makes sense to close this PR as well, because it seems we can't reuse anything from it (neither implementation nor tests).

@gavv gavv closed this Oct 7, 2023
@gavv gavv removed the ready for review Pull request can be reviewed label Oct 7, 2023
@edwinwijaya94
Copy link
Contributor Author

sure, will take a look.
thanks

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.

Honor FloatFormat when formatting maps and slices
2 participants