chore: fix a few lint issues in code

This commit is contained in:
Andy Pan 2024-04-15 18:13:28 +08:00
parent 83817c11bb
commit 34ff2c2282

View File

@ -242,7 +242,7 @@ func TestPanicHandler(t *testing.T) {
c := atomic.LoadInt64(&panicCounter) c := atomic.LoadInt64(&panicCounter)
assert.EqualValuesf(t, 1, c, "panic handler didn't work, panicCounter: %d", c) assert.EqualValuesf(t, 1, c, "panic handler didn't work, panicCounter: %d", c)
assert.EqualValues(t, 0, p0.Running(), "pool should be empty after panic") assert.EqualValues(t, 0, p0.Running(), "pool should be empty after panic")
p1, err := NewPoolWithFunc(10, func(p interface{}) { panic(p) }, WithPanicHandler(func(p interface{}) { p1, err := NewPoolWithFunc(10, func(p interface{}) { panic(p) }, WithPanicHandler(func(_ interface{}) {
defer wg.Done() defer wg.Done()
atomic.AddInt64(&panicCounter, 1) atomic.AddInt64(&panicCounter, 1)
})) }))
@ -274,7 +274,7 @@ func TestPanicHandlerPreMalloc(t *testing.T) {
c := atomic.LoadInt64(&panicCounter) c := atomic.LoadInt64(&panicCounter)
assert.EqualValuesf(t, 1, c, "panic handler didn't work, panicCounter: %d", c) assert.EqualValuesf(t, 1, c, "panic handler didn't work, panicCounter: %d", c)
assert.EqualValues(t, 0, p0.Running(), "pool should be empty after panic") assert.EqualValues(t, 0, p0.Running(), "pool should be empty after panic")
p1, err := NewPoolWithFunc(10, func(p interface{}) { panic(p) }, WithPanicHandler(func(p interface{}) { p1, err := NewPoolWithFunc(10, func(p interface{}) { panic(p) }, WithPanicHandler(func(_ interface{}) {
defer wg.Done() defer wg.Done()
atomic.AddInt64(&panicCounter, 1) atomic.AddInt64(&panicCounter, 1)
})) }))
@ -667,7 +667,7 @@ func TestWithDisablePurgePoolFunc(t *testing.T) {
var wg1, wg2 sync.WaitGroup var wg1, wg2 sync.WaitGroup
wg1.Add(numWorker) wg1.Add(numWorker)
wg2.Add(numWorker) wg2.Add(numWorker)
p, _ := NewPoolWithFunc(numWorker, func(i interface{}) { p, _ := NewPoolWithFunc(numWorker, func(_ interface{}) {
wg1.Done() wg1.Done()
<-sig <-sig
wg2.Done() wg2.Done()
@ -682,7 +682,7 @@ func TestWithDisablePurgeAndWithExpirationPoolFunc(t *testing.T) {
wg1.Add(numWorker) wg1.Add(numWorker)
wg2.Add(numWorker) wg2.Add(numWorker)
expiredDuration := time.Millisecond * 100 expiredDuration := time.Millisecond * 100
p, _ := NewPoolWithFunc(numWorker, func(i interface{}) { p, _ := NewPoolWithFunc(numWorker, func(_ interface{}) {
wg1.Done() wg1.Done()
<-sig <-sig
wg2.Done() wg2.Done()
@ -914,7 +914,7 @@ func TestPoolTuneScaleUp(t *testing.T) {
p.Release() p.Release()
// test PoolWithFunc // test PoolWithFunc
pf, _ := NewPoolWithFunc(2, func(i interface{}) { pf, _ := NewPoolWithFunc(2, func(_ interface{}) {
<-c <-c
}) })
for i := 0; i < 2; i++ { for i := 0; i < 2; i++ {