Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deepsource: VET-V0008 lock erroneously passed by value internal/iocopy, info, errgroup #1860

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions internal/errgroup/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion internal/info/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 6 additions & 2 deletions internal/io/copy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"io"
"reflect"
"sync"
"sync/atomic"
"testing"

"github.com/vdaas/vald/internal/errors"
Expand Down Expand Up @@ -279,7 +280,6 @@ func Test_copier_Copy(t *testing.T) {
}
type fields struct {
bufSize int64
pool sync.Pool
}
type want struct {
wantWritten int64
Expand Down Expand Up @@ -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{}

Expand Down