Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions fast.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ func main() {

// measure
KbpsChan := make(chan float64)

go func() {
done := make(chan bool)
go func(done chan bool) {
var value, units string
for Kbps := range KbpsChan {
value, units = format(Kbps, kb, mb, gb)
Expand All @@ -78,7 +78,9 @@ func main() {
} else {
fmt.Printf("\r%c[2K -> %s\n", 27, status)
}
}()

done <- true
}(done)

err = fastCom.Measure(urls, KbpsChan)
ticker.Stop()
Expand All @@ -87,6 +89,9 @@ func main() {
os.Exit(1)
}

// finish reading KbpsChan so that the result always gets printed
<- done

return
}

Expand Down