x/text/number: support formatting of custom types #28451
Labels
FeatureRequest
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
This is based on a StackOverflow question.
Package
golang.org/x/text/number
allows locale-specific formatting of numbers à-lafmt
. Unfortunately, unlikefmt
, 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 whoseString()
method produces numbers were supported, but as of now that is still a TODO.The text was updated successfully, but these errors were encountered: