]> Cypherpunks.ru repositories - gostls13.git/commit
Revert "fmt: fix incorrect format of whole-number floats when using %#v"
authorFilippo Valsorda <filippo@golang.org>
Tue, 16 Oct 2018 17:01:07 +0000 (13:01 -0400)
committerFilippo Valsorda <filippo@golang.org>
Tue, 16 Oct 2018 21:54:35 +0000 (21:54 +0000)
commita52289ef2bf7e9b7a619caecc14d6c95eff9eeae
tree5baa3e49cc86a1e4bbebefe1e344d9d442d8025b
parent965fa3b191270bbc23a040a520ce43406ba29343
Revert "fmt: fix incorrect format of whole-number floats when using %#v"

Numbers without decimals are valid Go representations of whole-number
floats. That is, "var x float64 = 5" is valid Go. Avoid breakage in
tests that expect a certain output from %#v by reverting to it.

To guarantee the right type is generated by a print use %T(%#v) instead.

Added a test to lock in this behavior.

This reverts commit 7c7cecc1846aaaa0ce73931644fe1df2b4559e09.

Fixes #27634
Updates #26363

Change-Id: I544c400a0903777dd216452a7e86dfe60b0b0283
Reviewed-on: https://go-review.googlesource.com/c/142597
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/fmt/fmt_test.go
src/fmt/format.go
test/switch5.go