1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:04:42 -07:00

fmt: clarify reflect.Value printing

fmt docs say:

  If the operand is a reflect.Value, the concrete value it
  holds is printed as if it was the operand.

It implies recursive application of this rule, which is not the case.
Clarify the docs.

Change-Id: I019277c7c6439095bab83e5536aa06403638aa51
Reviewed-on: https://go-review.googlesource.com/15952
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Nodir Turakulov 2015-10-16 01:33:28 -07:00 committed by Ian Lance Taylor
parent 17a256bf22
commit 1da6b2ea19

View File

@ -138,8 +138,8 @@
formatting considerations apply for operands that implement formatting considerations apply for operands that implement
certain interfaces. In order of application: certain interfaces. In order of application:
1. If the operand is a reflect.Value, the concrete value it 1. If the operand is a reflect.Value, the operand is replaced by the
holds is printed as if it was the operand. concrete value that it holds, and printing continues with the next rule.
2. If an operand implements the Formatter interface, it will 2. If an operand implements the Formatter interface, it will
be invoked. Formatter provides fine control of formatting. be invoked. Formatter provides fine control of formatting.