golang/go

fmt: more doc needed for Formatter

Open

#42,476 创建于 2020年11月10日

在 GitHub 查看
 (5 评论) (0 反应) (0 负责人)Go (19,008 fork)batch import
DocumentationNeedsInvestigationhelp wanted

仓库指标

Star
 (133,883 star)
PR 合并指标
 (30 天内没有已合并 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

贡献者指南