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

x/text/number: support formatting of custom types #28451

Open
ainar-g opened this issue Oct 28, 2018 · 1 comment
Open

x/text/number: support formatting of custom types #28451

ainar-g opened this issue Oct 28, 2018 · 1 comment
Labels
FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ainar-g
Copy link
Contributor

ainar-g commented Oct 28, 2018

This is based on a StackOverflow question.

Package golang.org/x/text/number allows locale-specific formatting of numbers à-la fmt. Unfortunately, unlike fmt, this package doesn't have an interface to let types other than the built-in numeric types tell the package how to format them. Or rather, the interface is there, but it's in an internal package, so the users can't really implement it.

This wouldn't be bad if math/big types or types whose String() method produces numbers were supported, but as of now that is still a TODO.

@gopherbot gopherbot added this to the Unreleased milestone Oct 28, 2018
@ainar-g ainar-g changed the title x/text/number: support custom formatting x/text/number: support formatting of custom types Oct 28, 2018
@ainar-g
Copy link
Contributor Author

ainar-g commented Dec 1, 2018

This may or may not be a dup of #15274, although that issue only concerns currency amounts.

@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. FeatureRequest labels Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants