diff --git a/ants.go b/ants.go index 2df74ad..ed14312 100644 --- a/ants.go +++ b/ants.go @@ -68,7 +68,8 @@ var ( //--------------------------------------------------------------------------- // workerChanCap determines whether the channel of a worker should be a buffered channel - // to get the best performance. Inspired by fasthttp at https://github.com/valyala/fasthttp/blob/master/workerpool.go#L139 + // to get the best performance. Inspired by fasthttp at + // https://github.com/valyala/fasthttp/blob/master/workerpool.go#L139 workerChanCap = func() int { // Use blocking workerChan if GOMAXPROCS=1. // This immediately switches Serve to WorkerFunc, which results diff --git a/ants_test.go b/ants_test.go index b1b977b..2ff430c 100644 --- a/ants_test.go +++ b/ants_test.go @@ -378,7 +378,8 @@ func TestNonblockingSubmit(t *testing.T) { } // p is full now. assert.NoError(t, p.Submit(f), "nonblocking submit when pool is not full shouldn't return error") - assert.EqualError(t, p.Submit(demoFunc), ErrPoolOverload.Error(), "nonblocking submit when pool is full should get an ErrPoolOverload") + assert.EqualError(t, p.Submit(demoFunc), ErrPoolOverload.Error(), + "nonblocking submit when pool is full should get an ErrPoolOverload") // interrupt f to get an available worker close(ch) <-ch1 @@ -411,7 +412,8 @@ func TestMaxBlockingSubmit(t *testing.T) { }() time.Sleep(1 * time.Second) // already reached max blocking limit - assert.EqualError(t, p.Submit(demoFunc), ErrPoolOverload.Error(), "blocking submit when pool reach max blocking submit should return ErrPoolOverload") + assert.EqualError(t, p.Submit(demoFunc), ErrPoolOverload.Error(), + "blocking submit when pool reach max blocking submit should return ErrPoolOverload") // interrupt f to make blocking submit successful. close(ch) wg.Wait() @@ -437,7 +439,8 @@ func TestNonblockingSubmitWithFunc(t *testing.T) { ch := make(chan struct{}) // p is full now. assert.NoError(t, p.Invoke(ch), "nonblocking submit when pool is not full shouldn't return error") - assert.EqualError(t, p.Invoke(nil), ErrPoolOverload.Error(), "nonblocking submit when pool is full should get an ErrPoolOverload") + assert.EqualError(t, p.Invoke(nil), ErrPoolOverload.Error(), + "nonblocking submit when pool is full should get an ErrPoolOverload") // interrupt f to get an available worker close(ch) <-ch1 @@ -467,7 +470,8 @@ func TestMaxBlockingSubmitWithFunc(t *testing.T) { }() time.Sleep(1 * time.Second) // already reached max blocking limit - assert.EqualErrorf(t, p.Invoke(Param), ErrPoolOverload.Error(), "blocking submit when pool reach max blocking submit should return ErrPoolOverload: %v", err) + assert.EqualErrorf(t, p.Invoke(Param), ErrPoolOverload.Error(), + "blocking submit when pool reach max blocking submit should return ErrPoolOverload: %v", err) // interrupt one func to make blocking submit successful. close(ch) wg.Wait() diff --git a/doc.go b/doc.go deleted file mode 100644 index e224310..0000000 --- a/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -/* -Library ants implements a goroutine pool with fixed capacity, managing and recycling a massive number of goroutines, -allowing developers to limit the number of goroutines in your concurrent programs. -*/ -package ants diff --git a/options.go b/options.go index 709c63c..87b3aa6 100644 --- a/options.go +++ b/options.go @@ -34,7 +34,8 @@ type Options struct { // if nil, panics will be thrown out again from worker goroutines. PanicHandler func(interface{}) - // Logger is the customized logger for logging info, if it is not set, default standard logger from log package is used. + // Logger is the customized logger for logging info, if it is not set, + // default standard logger from log package is used. Logger Logger } diff --git a/pool_func.go b/pool_func.go index cd556dc..8752396 100644 --- a/pool_func.go +++ b/pool_func.go @@ -30,7 +30,8 @@ import ( "github.com/panjf2000/ants/v2/internal" ) -// PoolWithFunc accepts the tasks from client, it limits the total of goroutines to a given number by recycling goroutines. +// PoolWithFunc accepts the tasks from client, +// it limits the total of goroutines to a given number by recycling goroutines. type PoolWithFunc struct { // capacity of the pool. capacity int32 diff --git a/worker_stack_test.go b/worker_stack_test.go index 2c33e08..1bddf9d 100644 --- a/worker_stack_test.go +++ b/worker_stack_test.go @@ -48,8 +48,8 @@ func TestWorkerStack(t *testing.T) { assert.EqualValues(t, 6, q.len(), "Len error") } -// It seems that something wrong with time.Now() on Windows, not sure whether it is a bug on Windows, so exclude this test -// from Windows platform temporarily. +// It seems that something wrong with time.Now() on Windows, not sure whether it is a bug on Windows, +// so exclude this test from Windows platform temporarily. func TestSearch(t *testing.T) { q := newWorkerStack(0)