golang/go

fmt: more doc needed for Formatter

Open

#42,476 opened on 2020年11月10日

GitHub で見る
 (5 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
DocumentationNeedsInvestigationhelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (30d に merged PR はありません)

説明

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

コントリビューターガイド