-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
fmt: more doc needed for Formatter #42476
Comments
There are no constraints how to implement formatters apart from the function signature. Its up to the developer to decide what should be handled how for each type. Which verbs produce output and which dont. Which verbs are implemented directly and which are formatted using other functions. An example could be added. Contributions welcome. |
Yes, there are no constraints. But guidelines or best practices would still be helpful. Also the stdlib has very few implementation of that interface ( |
It will be great to add an example for it. I would love to create a PR if needed. |
To maintain consistency, I used GoStringer's example. Maybe we can add more verbs in the example if needed.
|
Your example shows an implementation of Format that implemts My point of view would be that it is an incomplete implementation of |
Current (go1.15, tip) documentation of interface
fmt.Formatter
:This is insufficient to tell how one must implement this interface:
Printf
?The text was updated successfully, but these errors were encountered: