Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4768)

Issue 146650043: code review 146650043: fmt: make the %#v verb a special flag (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 6 months ago by r
Modified:
9 years, 6 months ago
Reviewers:
gobot, iant, Chris Hines
CC:
golang-codereviews, iant
Visibility:
Public.

Description

fmt: make the %#v verb a special flag The %#v verb is special: it says all values below need to print as %#v. However, for some situations the # flag has other meanings and this causes some issues, particularly in how Formatters work. Since %#v dominates all formatting, translate it into actual state of the formatter and decouple it from the # flag itself within the calculations (although it must be restored when methods are doing the work.) The result is cleaner code and correct handling of # for Formatters. TODO: Apply the same thinking to the + flag in a followup CL. Also, the wasString return value in handleMethods is always false, so eliminate it. Update issue 8835

Patch Set 1 #

Patch Set 2 : diff -r 25a1150f9f3d1f0539e827cb50c15014f0915e08 https://code.google.com/p/go #

Total comments: 10

Patch Set 3 : diff -r 52bacae4f5b0f55fb07cc2634d151d399a44c314 https://code.google.com/p/go #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+196 lines, -84 lines) Patch
M src/fmt/fmt_test.go View 2 chunks +93 lines, -2 lines 1 comment Download
M src/fmt/format.go View 1 2 2 chunks +9 lines, -3 lines 0 comments Download
M src/fmt/print.go View 1 2 27 chunks +94 lines, -79 lines 0 comments Download

Messages

Total messages: 6
r
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
9 years, 6 months ago (2014-10-01 17:50:48 UTC) #1
iant
LGTM Various minor suggestions. https://codereview.appspot.com/146650043/diff/20001/src/fmt/format.go File src/fmt/format.go (right): https://codereview.appspot.com/146650043/diff/20001/src/fmt/format.go#newcode52 src/fmt/format.go:52: // For the format %#v, ...
9 years, 6 months ago (2014-10-02 19:53:32 UTC) #2
r
*** Submitted as https://code.google.com/p/go/source/detail?r=1ebe0bc97711 *** fmt: make the %#v verb a special flag The %#v ...
9 years, 6 months ago (2014-10-02 21:17:02 UTC) #3
gobot
This changed caused perf changes on windows-amd64-perf: json-1 old new delta cputime 170937500 176875000 +3.47 ...
9 years, 6 months ago (2014-10-03 05:38:04 UTC) #4
Chris Hines
LGTM just one observation https://codereview.appspot.com/146650043/diff/40001/src/fmt/fmt_test.go File src/fmt/fmt_test.go (right): https://codereview.appspot.com/146650043/diff/40001/src/fmt/fmt_test.go#newcode1214 src/fmt/fmt_test.go:1214: func (fp) Format(f State, c ...
9 years, 6 months ago (2014-10-03 19:21:49 UTC) #5
r
9 years, 6 months ago (2014-10-03 20:16:30 UTC) #6
Thanks, well spotted. Fixed in the next CL.

On Fri, Oct 3, 2014 at 12:21 PM,  <chris.cs.guy@gmail.com> wrote:
> LGTM
>
> just one observation
>
>
> https://codereview.appspot.com/146650043/diff/40001/src/fmt/fmt_test.go
> File src/fmt/fmt_test.go (right):
>
>
https://codereview.appspot.com/146650043/diff/40001/src/fmt/fmt_test.go#newco...
> src/fmt/fmt_test.go:1214: func (fp) Format(f State, c rune) {
> Type fp and its Format method are an exact duplicate of type flagPrinter
> (line 920 this file).
>
> https://codereview.appspot.com/146650043/
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b