@@ -35,15 +35,15 @@ func round(bwc *BandwidthCounter, b *testing.B) {
3535 start := make (chan struct {})
3636 var wg sync.WaitGroup
3737 wg .Add (10000 )
38- for i := 0 ; i < 1000 ; i ++ {
38+ for i := range 1000 {
3939 p := peer .ID (fmt .Sprintf ("peer-%d" , i ))
40- for j := 0 ; j < 10 ; j ++ {
40+ for j := range 10 {
4141 proto := protocol .ID (fmt .Sprintf ("bitswap-%d" , j ))
4242 go func () {
4343 defer wg .Done ()
4444 <- start
4545
46- for i := 0 ; i < 1000 ; i ++ {
46+ for range 1000 {
4747 bwc .LogSentMessage (100 )
4848 bwc .LogSentMessageStream (100 , proto , p )
4949 time .Sleep (1 * time .Millisecond )
@@ -60,10 +60,10 @@ func round(bwc *BandwidthCounter, b *testing.B) {
6060
6161func TestBandwidthCounter (t * testing.T ) {
6262 bwc := NewBandwidthCounter ()
63- for i := 0 ; i < 40 ; i ++ {
64- for i := 0 ; i < 100 ; i ++ {
63+ for range 40 {
64+ for i := range 100 {
6565 p := peer .ID (fmt .Sprintf ("peer-%d" , i ))
66- for j := 0 ; j < 2 ; j ++ {
66+ for j := range 2 {
6767 proto := protocol .ID (fmt .Sprintf ("proto-%d" , j ))
6868
6969 // make sure the bandwidth counters are active
@@ -81,7 +81,7 @@ func TestBandwidthCounter(t *testing.T) {
8181 assertProtocols := func (check func (Stats )) {
8282 byProtocol := bwc .GetBandwidthByProtocol ()
8383 require .Len (t , byProtocol , 2 , "expected 2 protocols" )
84- for i := 0 ; i < 2 ; i ++ {
84+ for i := range 2 {
8585 p := protocol .ID (fmt .Sprintf ("proto-%d" , i ))
8686 for _ , stats := range [... ]Stats {bwc .GetBandwidthForProtocol (p ), byProtocol [p ]} {
8787 check (stats )
@@ -92,7 +92,7 @@ func TestBandwidthCounter(t *testing.T) {
9292 assertPeers := func (check func (Stats )) {
9393 byPeer := bwc .GetBandwidthByPeer ()
9494 require .Len (t , byPeer , 100 , "expected 100 peers" )
95- for i := 0 ; i < 100 ; i ++ {
95+ for i := range 100 {
9696 p := peer .ID (fmt .Sprintf ("peer-%d" , i ))
9797 for _ , stats := range [... ]Stats {bwc .GetBandwidthForPeer (p ), byPeer [p ]} {
9898 check (stats )
0 commit comments