diff --git a/internal/errgroup/group_test.go b/internal/errgroup/group_test.go index 6cee962776..864be84e0c 100644 --- a/internal/errgroup/group_test.go +++ b/internal/errgroup/group_test.go @@ -793,11 +793,9 @@ func Test_group_closeLimitation(t *testing.T) { type fields struct { egctx context.Context cancel context.CancelFunc - wg sync.WaitGroup limitation chan struct{} enableLimitation atomic.Value cancelOnce sync.Once - mu sync.RWMutex emap map[string]struct{} errs []error err error @@ -822,11 +820,9 @@ func Test_group_closeLimitation(t *testing.T) { fields: fields { egctx: nil, cancel: nil, - wg: sync.WaitGroup{}, limitation: nil, enableLimitation: nil, cancelOnce: sync.Once{}, - mu: sync.RWMutex{}, emap: nil, errs: nil, err: nil, @@ -844,11 +840,9 @@ func Test_group_closeLimitation(t *testing.T) { fields: fields { egctx: nil, cancel: nil, - wg: sync.WaitGroup{}, limitation: nil, enableLimitation: nil, cancelOnce: sync.Once{}, - mu: sync.RWMutex{}, emap: nil, errs: nil, err: nil, @@ -877,11 +871,9 @@ func Test_group_closeLimitation(t *testing.T) { g := &group{ egctx: test.fields.egctx, cancel: test.fields.cancel, - wg: test.fields.wg, limitation: test.fields.limitation, enableLimitation: test.fields.enableLimitation, cancelOnce: test.fields.cancelOnce, - mu: test.fields.mu, emap: test.fields.emap, errs: test.fields.errs, err: test.fields.err, diff --git a/internal/info/info.go b/internal/info/info.go index a7d801c847..21ffdb01ad 100644 --- a/internal/info/info.go +++ b/internal/info/info.go @@ -263,7 +263,7 @@ func (i *info) Get() Detail { return i.get() } -func (i info) get() Detail { +func (i *info) get() Detail { i.detail.StackTrace = make([]StackTrace, 0, 10) for j := 2; ; j++ { pc, file, line, ok := i.rtCaller(j) diff --git a/internal/io/copy_test.go b/internal/io/copy_test.go index 3328a41a51..25d9067464 100644 --- a/internal/io/copy_test.go +++ b/internal/io/copy_test.go @@ -22,6 +22,7 @@ import ( "io" "reflect" "sync" + "sync/atomic" "testing" "github.com/vdaas/vald/internal/errors" @@ -279,7 +280,6 @@ func Test_copier_Copy(t *testing.T) { } type fields struct { bufSize int64 - pool sync.Pool } type want struct { wantWritten int64 @@ -326,7 +326,11 @@ func Test_copier_Copy(t *testing.T) { } c := &copier{ bufSize: test.fields.bufSize, - pool: test.fields.pool, + } + c.pool = sync.Pool{ + New: func() interface{} { + return bytes.NewBuffer(make([]byte, int(atomic.LoadInt64(&c.bufSize)))) + }, } dst := &bytes.Buffer{}