This files were added accidentally and are
not required for running the tests (they
are produced by failing tests for easier
debugging).
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/131030044
3-index slices of the form s[:len(s):len(s)]
cannot be simplified to s[::len(s)].
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/108330043
* Sort imports by import path, then import name, then comment. Currently, gofmt sorts only by import path.
* If two imports have the same import path and import name, and one of them has no comment, remove the import with no comment. (See the discussion at issue 4414.)
Based on @rsc's https://golang.org/cl/7231070/Fixes#4414.
R=gri, rsc
CC=golang-dev
https://golang.org/cl/12837044
My old code was trying to be too smart.
Also: Slightly better error message format
for gofmt -r pattern errors.
Fixes#4406.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/8267045
(see also issue 3961).
hexdump -c testdata/crlf.input
0000000 / * \r \n \t S o u r c e c o n t
0000010 a i n i n g C R / L F l i n
0000020 e e n d i n g s . \r \n \t T h e
0000030 g o f m t ' e d o u t p u t
0000040 m u s t o n l y h a v e
0000050 L F \r \n \t l i n e e n d i n g
0000060 s . \r \n * / \r \n p a c k a g e
0000070 m a i n \r \n \r \n f u n c m a i
0000080 n ( ) { \r \n \t / / l i n e
0000090 c o m m e n t \r \n \t p r i n t l
00000a0 n ( " h e l l o , w o r l d !
00000b0 " ) / / a n o t h e r l i
00000c0 n e c o m m e n t \r \n \t p r i
00000d0 n t l n ( ) \r \n } \r \n
00000db
hexdump -c testdata/crlf.golden
0000000 / * \n \t S o u r c e c o n t a
0000010 i n i n g C R / L F l i n e
0000020 e n d i n g s . \n \t T h e g
0000030 o f m t ' e d o u t p u t m
0000040 u s t o n l y h a v e L F
0000050 \n \t l i n e e n d i n g s . \n
0000060 * / \n p a c k a g e m a i n \n
0000070 \n f u n c m a i n ( ) { \n \t
0000080 / / l i n e c o m m e n t \n
0000090 \t p r i n t l n ( " h e l l o ,
00000a0 w o r l d ! " ) / / a n o
00000b0 t h e r l i n e c o m m e n
00000c0 t \n \t p r i n t l n ( ) \n } \n
00000cf
R=rsc
CC=golang-dev
https://golang.org/cl/6526052
Also: Simplified handling of selector expressions. As a result, complicated
multi-line expressions containing selectors and calls/indices with arguments
broken accross lines don't get indented the same way as before, but the change
is minimal (see tests) and there's no such code in the std library. It seems
a worthwhile compromise given the much simpler code.
Applied gofmt -w $GOROOT/src $GOROOT/misc .
Fixes#1847.
R=rsc
CC=golang-dev
https://golang.org/cl/5675062
Without this check, gofmt panics when trying to apply
the identity transformation on "item.field" expressions.
Fixes#2410.
R=rsc, gri
CC=golang-dev, remy
https://golang.org/cl/5376061
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.
R=gri
CC=golang-dev
https://golang.org/cl/4973074
The new reflection API makes it an error to call value.Set(x)
if x is invalid. Guard for it.
Added corresponding test case.
Fixes#1696.
R=rsc, r
CC=golang-dev
https://golang.org/cl/4398047
- replaced existing testdata/test.sh with new gofmt_test
- added initial test case for rewrite tests
TODO: Need to add more tests.
R=rsc
CC=golang-dev
https://golang.org/cl/4368063