addressed linting and spelling.
This commit is contained in:
parent
fc1f5ce2bc
commit
89425716d1
4
bps.go
4
bps.go
@ -12,7 +12,7 @@ const (
|
|||||||
minResolution = 3
|
minResolution = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
// BPS calculates bandwith rates.
|
// BPS calculates bandwidth rates.
|
||||||
//
|
//
|
||||||
// Instantiate a BPS using one of the New* functions then feed bytes either via
|
// Instantiate a BPS using one of the New* functions then feed bytes either via
|
||||||
// BPS.Add, or writing to it (it implements io.Writer). When the accumulated
|
// BPS.Add, or writing to it (it implements io.Writer). When the accumulated
|
||||||
@ -118,7 +118,7 @@ func (b *BPS) Add(i int64) {
|
|||||||
// Rate returns the current rate (bytes / second).
|
// Rate returns the current rate (bytes / second).
|
||||||
func (b *BPS) Rate() float64 {
|
func (b *BPS) Rate() float64 {
|
||||||
b.Lock()
|
b.Lock()
|
||||||
var total int64 = 0
|
var total int64
|
||||||
for _, b := range b.buckets {
|
for _, b := range b.buckets {
|
||||||
total += b
|
total += b
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ func TestWriter(t *testing.T) {
|
|||||||
time.Sleep(2 * time.Second)
|
time.Sleep(2 * time.Second)
|
||||||
for i := 0; i < 100; i++ {
|
for i := 0; i < 100; i++ {
|
||||||
if bw.Rate() > 0 {
|
if bw.Rate() > 0 {
|
||||||
t.Errorf("got high rate: got, want 0.0000", bw.Rate())
|
t.Errorf("got high rate: got %f, want 0.0000", bw.Rate())
|
||||||
}
|
}
|
||||||
time.Sleep(9 * time.Millisecond)
|
time.Sleep(9 * time.Millisecond)
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ func TestAdd(t *testing.T) {
|
|||||||
time.Sleep(2 * time.Second)
|
time.Sleep(2 * time.Second)
|
||||||
for i := 0; i < 100; i++ {
|
for i := 0; i < 100; i++ {
|
||||||
if bw.Rate() > 0 {
|
if bw.Rate() > 0 {
|
||||||
t.Errorf("got high rate: got, want 0.0000", bw.Rate())
|
t.Errorf("got high rate: got %v, want 0.0000", bw.Rate())
|
||||||
}
|
}
|
||||||
time.Sleep(9 * time.Millisecond)
|
time.Sleep(9 * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user