```go
package main
import (
"fmt"
"time"
"go.uber.org/ratelimit"
)
func main() {
rate := ratelimit.New(2) //per second
begin := time.Now()
// fmt.Println(begin)
for i := 0; i < 10; i++ {
now := rate.Take()
// fmt.Println(now)÷
fmt.Println(i, now.Sub(begin))
begin = now
}
}
```
有疑问加站长微信联系(非本文作者))