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

Issue 4973074: code review 4973074: gofmt: accept program fragments on standard input (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 7 months ago by rsc
Modified:
10 years, 8 months ago
Reviewers:
gri, shurcooL, rog
CC:
gri, golang-dev
Visibility:
Public.

Description

gofmt: accept program fragments on standard input This makes it possible to grab a block of code in an editor and pipe it through gofmt, instead of having to pipe in the entire file.

Patch Set 1 #

Patch Set 2 : diff -r 1b800cd636c0 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 2a7da934d64e https://go.googlecode.com/hg #

Total comments: 7

Patch Set 4 : diff -r 2a7da934d64e https://go.googlecode.com/hg #

Total comments: 1

Patch Set 5 : diff -r 15ef4af128a8 https://go.googlecode.com/hg #

Unified diffs Side-by-side diffs Delta from patch set Stats (+242 lines, -18 lines) Patch
M src/cmd/gofmt/doc.go View 1 1 chunk +6 lines, -0 lines 0 comments Download
M src/cmd/gofmt/gofmt.go View 1 2 3 7 chunks +112 lines, -6 lines 0 comments Download
M src/cmd/gofmt/gofmt_test.go View 1 4 chunks +33 lines, -12 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin1.golden View 1 1 chunk +3 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin1.input View 1 1 chunk +3 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin1.golden.gofmt View 1 1 chunk +3 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin1.input.gofmt View 1 1 chunk +3 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin2.golden View 1 1 chunk +11 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin2.input View 1 1 chunk +11 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin2.golden.gofmt View 1 1 chunk +10 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin2.input.gofmt View 1 1 chunk +11 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin3.golden View 1 1 chunk +6 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin3.input View 1 1 chunk +4 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin3.golden.gofmt View 1 1 chunk +7 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin3.input.gofmt View 1 1 chunk +7 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin4.golden View 1 1 chunk +3 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin4.input View 1 1 chunk +3 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin4.golden.gofmt View 1 1 chunk +3 lines, -0 lines 0 comments Download
A src/cmd/gofmt/testdata/stdin4.input.gofmt View 1 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 10
rsc
Hello gri (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg
13 years, 7 months ago (2011-09-12 18:11:30 UTC) #1
gri
looks pretty good, some comments - gri http://codereview.appspot.com/4973074/diff/4001/src/cmd/gofmt/gofmt.go File src/cmd/gofmt/gofmt.go (right): http://codereview.appspot.com/4973074/diff/4001/src/cmd/gofmt/gofmt.go#newcode281 src/cmd/gofmt/gofmt.go:281: psrc := ...
13 years, 7 months ago (2011-09-12 18:52:25 UTC) #2
rsc
On Mon, Sep 12, 2011 at 14:52, <gri@golang.org> wrote: > http://codereview.appspot.com/4973074/diff/4001/src/cmd/gofmt/gofmt.go#newcode281 > src/cmd/gofmt/gofmt.go:281: psrc := ...
13 years, 7 months ago (2011-09-12 19:12:13 UTC) #3
rsc
Hello gri@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 7 months ago (2011-09-12 19:12:23 UTC) #4
gri
LGTM http://codereview.appspot.com/4973074/diff/10001/src/cmd/gofmt/gofmt.go File src/cmd/gofmt/gofmt.go (right): http://codereview.appspot.com/4973074/diff/10001/src/cmd/gofmt/gofmt.go#newcode347 src/cmd/gofmt/gofmt.go:347: before, indent := before[:i+1], before[i+1:] nice
13 years, 7 months ago (2011-09-12 19:23:41 UTC) #5
rsc
*** Submitted as http://code.google.com/p/go/source/detail?r=94ae7c289be2 *** gofmt: accept program fragments on standard input This makes it ...
13 years, 7 months ago (2011-09-12 19:41:53 UTC) #6
rog
great. i looked at doing this a while ago and failed to come up with ...
13 years, 7 months ago (2011-09-12 21:00:25 UTC) #7
shurcooL
Why were the *.gofmt files added to vcs? Aren't they just temporary files written out ...
10 years, 8 months ago (2014-08-21 06:43:40 UTC) #8
gri
Dmitri; you are absolutely correct - thanks for pointing this out, I missed it: https://codereview.appspot.com/131030044 ...
10 years, 8 months ago (2014-08-21 21:29:49 UTC) #9
shurcooL
10 years, 8 months ago (2014-08-21 22:23:39 UTC) #10
Message was sent while issue was closed.
I'm very happy to be useful! Thank you for fixing it now.


On 2014/08/21 21:29:49, gri wrote:
> Dmitri;
> 
> you are absolutely correct - thanks for pointing this out, I missed it:
> 
> https://codereview.appspot.com/131030044
> 
> - gri
> 
> 
> On Wed, Aug 20, 2014 at 11:43 PM, <mailto:shurcooL@gmail.com> wrote:
> 
> > Why were the *.gofmt files added to vcs? Aren't they just temporary
> > files written out when
> > output of gofmt on *.input doesn't match the corresponding *.golden
> > (i.e., tests failing)?
> >
> > It is confusing to see 4 files per test case (.input, .input.gofmt,
> > .golden, .golden.gofmt), and
> > took me a while to figure out when I wanted to add a new test case.
> >
> > I think the *.gofmt files should be removed, unless there's a good
> > reason for them
> > to exist, or if I misunderstood their purpose.
> >
> >
> > On 2011/09/12 21:00:25, rog wrote:
> >
> >> great. i looked at doing this a while ago and failed to come
> >> up with a nice way of doing it.
> >>
> >
> >  On 12 September 2011 19:11,  <mailto:rsc@golang.org> wrote:
> >> > Reviewers: gri,
> >> >
> >> > Message:
> >> > Hello gri (cc: mailto:golang-dev@googlegroups.com),
> >> >
> >> > I'd like you to review this change to
> >> > https://go.googlecode.com/hg
> >> >
> >> >
> >> > Description:
> >> > gofmt: accept program fragments on standard input
> >> >
> >> > This makes it possible to grab a block of code
> >> > in an editor and pipe it through gofmt, instead of
> >> > having to pipe in the entire file.
> >> >
> >> > Please review this at http://codereview.appspot.com/4973074/
> >> >
> >> > Affected files:
> >> > &nbsp;M src/cmd/gofmt/doc.go
> >> > &nbsp;M src/cmd/gofmt/gofmt.go
> >> > &nbsp;M src/cmd/gofmt/gofmt_test.go
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin1.golden
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin1.golden.gofmt
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin1.input
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin1.input.gofmt
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin2.golden
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin2.golden.gofmt
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin2.input
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin2.input.gofmt
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin3.golden
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin3.golden.gofmt
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin3.input
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin3.input.gofmt
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin4.golden
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin4.golden.gofmt
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin4.input
> >> > &nbsp;A src/cmd/gofmt/testdata/stdin4.input.gofmt
> >> >
> >> >
> >> >
> >>
> >
> >
> > https://codereview.appspot.com/4973074/
> >
Sign in to reply to this message.

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