golang/go

fmt: more doc needed for Formatter

Open

#42,476 opened on Nov 10, 2020

View on GitHub
 (5 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
DocumentationNeedsInvestigationhelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Current (go1.15, tip) documentation of interface fmt.Formatter:

Formatter is implemented by any value that has a Format method. The implementation controls how State and rune are interpreted, and may call Sprint(f) or Fprint(f) etc. to generate its output.

This is insufficient to tell how one must implement this interface:

  • which verbs should be handled for each type?
  • how to handle unhandled verbs?
  • how to forward unhandled verbs to Printf?
  • how to handle unhandled width?
  • how to handle unhandled precision?
  • lack of example

Contributor guide