mirror of
https://github.com/golang/go
synced 2024-11-12 10:20:27 -07:00
cmd/gofmt: document -s transformations
R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/13721043
This commit is contained in:
parent
d237f3ce6f
commit
d445b76331
@ -71,6 +71,25 @@ To remove the parentheses:
|
||||
To convert the package tree from explicit slice upper bounds to implicit ones:
|
||||
|
||||
gofmt -r 'α[β:len(α)] -> α[β:]' -w $GOROOT/src/pkg
|
||||
|
||||
The simplify command
|
||||
|
||||
When invoked with -s gofmt will make the following source transformations where possible.
|
||||
|
||||
An array, slice, or map composite literal of the form:
|
||||
[]T{T{}, T{}}
|
||||
will be simplified to:
|
||||
[]T{{}, {}}
|
||||
|
||||
A slice expression of the form:
|
||||
s[a:len(s)]
|
||||
will be simplified to:
|
||||
s[a:]
|
||||
|
||||
A range of the form:
|
||||
for x, _ = range v {...}
|
||||
will be simplified to:
|
||||
for x = range v {...}
|
||||
*/
|
||||
package main
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user