ratelimit/ratelimit.go
func LimitChan(limit int) chan struct{} {
	limitch := make(chan struct{}, limit)
	for i := 0; i < limit; i++ {
		limitch <- struct{}{}
	}
	return limitch
}
func LimitChan(limit int) chan struct{} {
	limitch := make(chan struct{}, limit)
	for i := 0; i < limit; i++ {
		limitch <- struct{}{}
	}
	return limitch
}
func LimitChan ( limit int ) chan struct { } { limitch := make ( chan struct { } , limit ) for i := 0 ; i < limit ; i ++ { limitch <- struct { } { } } return limitch }
// LimitChan returns a rate-limiting channel. it is the usual, simple,
// golang-idiomatic rate-limiting semaphore. This function merely
// initializes it with certain buffer size, and sends that many values,
// so it is ready to be used.
LimitChan returns a rate - limiting channel . it is the usual simple golang - idiomatic rate - limiting semaphore . This function merely initializes it with certain buffer size and sends that many values so it is ready to be used .