mirror of
https://github.com/golang/go
synced 2024-11-23 18:20:04 -07:00
src, misc: applied gofmt -s -w
Pending CL 113120043. LGTM=dave R=golang-codereviews, dave CC=golang-codereviews https://golang.org/cl/112290043
This commit is contained in:
parent
8d504c4e97
commit
8a23c0021e
@ -1016,7 +1016,7 @@ func forFieldList(fl *ast.FieldList, fn func(int, ast.Expr)) {
|
|||||||
fn(i, r.Type)
|
fn(i, r.Type)
|
||||||
i++
|
i++
|
||||||
} else {
|
} else {
|
||||||
for _ = range r.Names {
|
for range r.Names {
|
||||||
fn(i, r.Type)
|
fn(i, r.Type)
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ func TestUnreadRuneError(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("unexpected error on ReadRune (2):", err)
|
t.Error("unexpected error on ReadRune (2):", err)
|
||||||
}
|
}
|
||||||
for _ = range buf {
|
for range buf {
|
||||||
_, err = r.ReadByte()
|
_, err = r.ReadByte()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("unexpected error on ReadByte (2):", err)
|
t.Error("unexpected error on ReadByte (2):", err)
|
||||||
|
@ -580,7 +580,7 @@ func (db *DB) maybeOpenNewConnections() {
|
|||||||
|
|
||||||
// Runs in a separate goroutine, opens new connections when requested.
|
// Runs in a separate goroutine, opens new connections when requested.
|
||||||
func (db *DB) connectionOpener() {
|
func (db *DB) connectionOpener() {
|
||||||
for _ = range db.openerCh {
|
for range db.openerCh {
|
||||||
db.openNewConnection()
|
db.openNewConnection()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1708,7 +1708,7 @@ func doConcurrentTest(t testing.TB, ct concurrentTest) {
|
|||||||
|
|
||||||
for i := 0; i < maxProcs*2; i++ {
|
for i := 0; i < maxProcs*2; i++ {
|
||||||
go func() {
|
go func() {
|
||||||
for _ = range reqs {
|
for range reqs {
|
||||||
err := ct.test(t)
|
err := ct.test(t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wg.Done()
|
wg.Done()
|
||||||
@ -1750,7 +1750,7 @@ func manyConcurrentQueries(t testing.TB) {
|
|||||||
|
|
||||||
for i := 0; i < maxProcs*2; i++ {
|
for i := 0; i < maxProcs*2; i++ {
|
||||||
go func() {
|
go func() {
|
||||||
for _ = range reqs {
|
for range reqs {
|
||||||
rows, err := stmt.Query()
|
rows, err := stmt.Query()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("error on query: %v", err)
|
t.Errorf("error on query: %v", err)
|
||||||
|
@ -357,7 +357,7 @@ func idents(f *ast.File) <-chan *ast.Ident {
|
|||||||
// identCount returns the number of identifiers found in f.
|
// identCount returns the number of identifiers found in f.
|
||||||
func identCount(f *ast.File) int {
|
func identCount(f *ast.File) int {
|
||||||
n := 0
|
n := 0
|
||||||
for _ = range idents(f) {
|
for range idents(f) {
|
||||||
n++
|
n++
|
||||||
}
|
}
|
||||||
return n
|
return n
|
||||||
|
@ -314,7 +314,7 @@ func TestConcurrentReconnect(t *testing.T) {
|
|||||||
count := make(chan int)
|
count := make(chan int)
|
||||||
go func() {
|
go func() {
|
||||||
ct := 0
|
ct := 0
|
||||||
for _ = range done {
|
for range done {
|
||||||
ct++
|
ct++
|
||||||
// we are looking for 500 out of 1000 events
|
// we are looking for 500 out of 1000 events
|
||||||
// here because lots of log messages are lost
|
// here because lots of log messages are lost
|
||||||
|
@ -488,7 +488,7 @@ func TestDialDualStackLocalhost(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
d := &Dialer{DualStack: true}
|
d := &Dialer{DualStack: true}
|
||||||
for _ = range dss.lns {
|
for range dss.lns {
|
||||||
if c, err := d.Dial("tcp", "localhost:"+dss.port); err != nil {
|
if c, err := d.Dial("tcp", "localhost:"+dss.port); err != nil {
|
||||||
t.Errorf("Dial failed: %v", err)
|
t.Errorf("Dial failed: %v", err)
|
||||||
} else {
|
} else {
|
||||||
|
@ -358,7 +358,7 @@ func (c *Cmd) Wait() error {
|
|||||||
c.ProcessState = state
|
c.ProcessState = state
|
||||||
|
|
||||||
var copyError error
|
var copyError error
|
||||||
for _ = range c.goroutine {
|
for range c.goroutine {
|
||||||
if err := <-c.errch; err != nil && copyError == nil {
|
if err := <-c.errch; err != nil && copyError == nil {
|
||||||
copyError = err
|
copyError = err
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ func BenchmarkGoroutineBlocking(b *testing.B) {
|
|||||||
|
|
||||||
func BenchmarkGoroutineForRange(b *testing.B) {
|
func BenchmarkGoroutineForRange(b *testing.B) {
|
||||||
read := func(ch chan struct{}) {
|
read := func(ch chan struct{}) {
|
||||||
for _ = range ch {
|
for range ch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
benchHelper(b, *n, read)
|
benchHelper(b, *n, read)
|
||||||
|
@ -253,7 +253,7 @@ func testConcurrentReadsAfterGrowth(t *testing.T, useReflect bool) {
|
|||||||
for nr := 0; nr < numReader; nr++ {
|
for nr := 0; nr < numReader; nr++ {
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
for _ = range m {
|
for range m {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -241,7 +241,7 @@ func BenchmarkMapIter(b *testing.B) {
|
|||||||
}
|
}
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
for _ = range m {
|
for range m {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,7 +250,7 @@ func BenchmarkMapIterEmpty(b *testing.B) {
|
|||||||
m := make(map[int]bool)
|
m := make(map[int]bool)
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
for _ = range m {
|
for range m {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
src/pkg/runtime/race/testdata/chan_test.go
vendored
4
src/pkg/runtime/race/testdata/chan_test.go
vendored
@ -88,7 +88,7 @@ func TestNoRaceChanAsyncCloseRecv3(t *testing.T) {
|
|||||||
v = 1
|
v = 1
|
||||||
close(c)
|
close(c)
|
||||||
}()
|
}()
|
||||||
for _ = range c {
|
for range c {
|
||||||
}
|
}
|
||||||
v = 2
|
v = 2
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ func TestNoRaceChanSyncCloseRecv3(t *testing.T) {
|
|||||||
v = 1
|
v = 1
|
||||||
close(c)
|
close(c)
|
||||||
}()
|
}()
|
||||||
for _ = range c {
|
for range c {
|
||||||
}
|
}
|
||||||
v = 2
|
v = 2
|
||||||
}
|
}
|
||||||
|
8
src/pkg/runtime/race/testdata/map_test.go
vendored
8
src/pkg/runtime/race/testdata/map_test.go
vendored
@ -57,7 +57,7 @@ func TestRaceMapRange(t *testing.T) {
|
|||||||
m := make(map[int]int)
|
m := make(map[int]int)
|
||||||
ch := make(chan bool, 1)
|
ch := make(chan bool, 1)
|
||||||
go func() {
|
go func() {
|
||||||
for _ = range m {
|
for range m {
|
||||||
}
|
}
|
||||||
ch <- true
|
ch <- true
|
||||||
}()
|
}()
|
||||||
@ -69,7 +69,7 @@ func TestRaceMapRange2(t *testing.T) {
|
|||||||
m := make(map[int]int)
|
m := make(map[int]int)
|
||||||
ch := make(chan bool, 1)
|
ch := make(chan bool, 1)
|
||||||
go func() {
|
go func() {
|
||||||
for _ = range m {
|
for range m {
|
||||||
}
|
}
|
||||||
ch <- true
|
ch <- true
|
||||||
}()
|
}()
|
||||||
@ -85,11 +85,11 @@ func TestNoRaceMapRangeRange(t *testing.T) {
|
|||||||
m[0] = 0
|
m[0] = 0
|
||||||
ch := make(chan bool, 1)
|
ch := make(chan bool, 1)
|
||||||
go func() {
|
go func() {
|
||||||
for _ = range m {
|
for range m {
|
||||||
}
|
}
|
||||||
ch <- true
|
ch <- true
|
||||||
}()
|
}()
|
||||||
for _ = range m {
|
for range m {
|
||||||
}
|
}
|
||||||
<-ch
|
<-ch
|
||||||
}
|
}
|
||||||
|
10
src/pkg/runtime/race/testdata/slice_test.go
vendored
10
src/pkg/runtime/race/testdata/slice_test.go
vendored
@ -198,7 +198,7 @@ func TestNoRaceStructSlicesRangeWrite(t *testing.T) {
|
|||||||
s.a = make([]int, 10)
|
s.a = make([]int, 10)
|
||||||
s.b = make([]int, 10)
|
s.b = make([]int, 10)
|
||||||
go func() {
|
go func() {
|
||||||
for _ = range s.a {
|
for range s.a {
|
||||||
}
|
}
|
||||||
ch <- true
|
ch <- true
|
||||||
}()
|
}()
|
||||||
@ -240,7 +240,7 @@ func TestNoRaceSliceRangeWrite(t *testing.T) {
|
|||||||
s[3] = 3
|
s[3] = 3
|
||||||
c <- true
|
c <- true
|
||||||
}()
|
}()
|
||||||
for _ = range s {
|
for range s {
|
||||||
}
|
}
|
||||||
<-c
|
<-c
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ func TestRaceSliceRangeAppend(t *testing.T) {
|
|||||||
s = append(s, 3)
|
s = append(s, 3)
|
||||||
c <- true
|
c <- true
|
||||||
}()
|
}()
|
||||||
for _ = range s {
|
for range s {
|
||||||
}
|
}
|
||||||
<-c
|
<-c
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ func TestNoRaceSliceRangeAppend(t *testing.T) {
|
|||||||
_ = append(s, 3)
|
_ = append(s, 3)
|
||||||
c <- true
|
c <- true
|
||||||
}()
|
}()
|
||||||
for _ = range s {
|
for range s {
|
||||||
}
|
}
|
||||||
<-c
|
<-c
|
||||||
}
|
}
|
||||||
@ -295,7 +295,7 @@ func TestRaceSliceVarRange(t *testing.T) {
|
|||||||
c := make(chan bool, 1)
|
c := make(chan bool, 1)
|
||||||
s := make([]int, 10)
|
s := make([]int, 10)
|
||||||
go func() {
|
go func() {
|
||||||
for _ = range s {
|
for range s {
|
||||||
}
|
}
|
||||||
c <- true
|
c <- true
|
||||||
}()
|
}()
|
||||||
|
@ -85,7 +85,7 @@ func BenchmarkRuneIterate(b *testing.B) {
|
|||||||
}
|
}
|
||||||
s := string(bytes)
|
s := string(bytes)
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
for _ = range s {
|
for range s {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ func BenchmarkRuneIterate2(b *testing.B) {
|
|||||||
}
|
}
|
||||||
s := string(bytes)
|
s := string(bytes)
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
for _ = range s {
|
for range s {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ func RuneCount(p []byte) int {
|
|||||||
|
|
||||||
// RuneCountInString is like RuneCount but its input is a string.
|
// RuneCountInString is like RuneCount but its input is a string.
|
||||||
func RuneCountInString(s string) (n int) {
|
func RuneCountInString(s string) (n int) {
|
||||||
for _ = range s {
|
for range s {
|
||||||
n++
|
n++
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user