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/client #1862

Merged
merged 2 commits into from
Nov 22, 2022
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
25 changes: 0 additions & 25 deletions internal/client/v1/client/filter/egress/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package egress
import (
"context"
"reflect"
"sync"
"testing"

"github.com/vdaas/vald/apis/grpc/v1/filter/egress"
Expand Down Expand Up @@ -115,7 +114,6 @@ func Test_client_Start(t *testing.T) {
}
type fields struct {
addrs []string
cl sync.Map
c grpc.Client
}
type want struct {
Expand Down Expand Up @@ -150,7 +148,6 @@ func Test_client_Start(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -168,7 +165,6 @@ func Test_client_Start(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -195,7 +191,6 @@ func Test_client_Start(t *testing.T) {
}
c := &client{
addrs: test.fields.addrs,
cl: test.fields.cl,
c: test.fields.c,
}

Expand All @@ -214,7 +209,6 @@ func Test_client_Stop(t *testing.T) {
}
type fields struct {
addrs []string
cl sync.Map
c grpc.Client
}
type want struct {
Expand Down Expand Up @@ -245,7 +239,6 @@ func Test_client_Stop(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -263,7 +256,6 @@ func Test_client_Stop(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -290,7 +282,6 @@ func Test_client_Stop(t *testing.T) {
}
c := &client{
addrs: test.fields.addrs,
cl: test.fields.cl,
c: test.fields.c,
}

Expand All @@ -306,7 +297,6 @@ func Test_client_GRPCClient(t *testing.T) {
t.Parallel()
type fields struct {
addrs []string
cl sync.Map
c grpc.Client
}
type want struct {
Expand All @@ -333,7 +323,6 @@ func Test_client_GRPCClient(t *testing.T) {
name: "test_case_1",
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -348,7 +337,6 @@ func Test_client_GRPCClient(t *testing.T) {
name: "test_case_2",
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -375,7 +363,6 @@ func Test_client_GRPCClient(t *testing.T) {
}
c := &client{
addrs: test.fields.addrs,
cl: test.fields.cl,
c: test.fields.c,
}

Expand All @@ -395,7 +382,6 @@ func Test_client_Target(t *testing.T) {
}
type fields struct {
addrs []string
cl sync.Map
c grpc.Client
}
type want struct {
Expand Down Expand Up @@ -431,7 +417,6 @@ func Test_client_Target(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -450,7 +435,6 @@ func Test_client_Target(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -477,7 +461,6 @@ func Test_client_Target(t *testing.T) {
}
c := &client{
addrs: test.fields.addrs,
cl: test.fields.cl,
c: test.fields.c,
}

Expand All @@ -498,7 +481,6 @@ func Test_client_FilterDistance(t *testing.T) {
}
type fields struct {
addrs []string
cl sync.Map
c grpc.Client
}
type want struct {
Expand Down Expand Up @@ -535,7 +517,6 @@ func Test_client_FilterDistance(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -555,7 +536,6 @@ func Test_client_FilterDistance(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -582,7 +562,6 @@ func Test_client_FilterDistance(t *testing.T) {
}
c := &client{
addrs: test.fields.addrs,
cl: test.fields.cl,
c: test.fields.c,
}

Expand Down Expand Up @@ -805,7 +784,6 @@ func Test_client_FilterVector(t *testing.T) {
}
type fields struct {
addrs []string
cl sync.Map
c grpc.Client
}
type want struct {
Expand Down Expand Up @@ -842,7 +820,6 @@ func Test_client_FilterVector(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -862,7 +839,6 @@ func Test_client_FilterVector(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -889,7 +865,6 @@ func Test_client_FilterVector(t *testing.T) {
}
c := &client{
addrs: test.fields.addrs,
cl: test.fields.cl,
c: test.fields.c,
}

Expand Down
25 changes: 0 additions & 25 deletions internal/client/v1/client/filter/ingress/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package ingress
import (
"context"
"reflect"
"sync"
"testing"

"github.com/vdaas/vald/apis/grpc/v1/filter/ingress"
Expand Down Expand Up @@ -115,7 +114,6 @@ func Test_client_Start(t *testing.T) {
}
type fields struct {
addrs []string
cl sync.Map
c grpc.Client
}
type want struct {
Expand Down Expand Up @@ -150,7 +148,6 @@ func Test_client_Start(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -168,7 +165,6 @@ func Test_client_Start(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -195,7 +191,6 @@ func Test_client_Start(t *testing.T) {
}
c := &client{
addrs: test.fields.addrs,
cl: test.fields.cl,
c: test.fields.c,
}

Expand All @@ -214,7 +209,6 @@ func Test_client_Stop(t *testing.T) {
}
type fields struct {
addrs []string
cl sync.Map
c grpc.Client
}
type want struct {
Expand Down Expand Up @@ -245,7 +239,6 @@ func Test_client_Stop(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -263,7 +256,6 @@ func Test_client_Stop(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -290,7 +282,6 @@ func Test_client_Stop(t *testing.T) {
}
c := &client{
addrs: test.fields.addrs,
cl: test.fields.cl,
c: test.fields.c,
}

Expand All @@ -306,7 +297,6 @@ func Test_client_GRPCClient(t *testing.T) {
t.Parallel()
type fields struct {
addrs []string
cl sync.Map
c grpc.Client
}
type want struct {
Expand All @@ -333,7 +323,6 @@ func Test_client_GRPCClient(t *testing.T) {
name: "test_case_1",
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -348,7 +337,6 @@ func Test_client_GRPCClient(t *testing.T) {
name: "test_case_2",
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -375,7 +363,6 @@ func Test_client_GRPCClient(t *testing.T) {
}
c := &client{
addrs: test.fields.addrs,
cl: test.fields.cl,
c: test.fields.c,
}

Expand All @@ -395,7 +382,6 @@ func Test_client_Target(t *testing.T) {
}
type fields struct {
addrs []string
cl sync.Map
c grpc.Client
}
type want struct {
Expand Down Expand Up @@ -431,7 +417,6 @@ func Test_client_Target(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -450,7 +435,6 @@ func Test_client_Target(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -477,7 +461,6 @@ func Test_client_Target(t *testing.T) {
}
c := &client{
addrs: test.fields.addrs,
cl: test.fields.cl,
c: test.fields.c,
}

Expand All @@ -498,7 +481,6 @@ func Test_client_GenVector(t *testing.T) {
}
type fields struct {
addrs []string
cl sync.Map
c grpc.Client
}
type want struct {
Expand Down Expand Up @@ -535,7 +517,6 @@ func Test_client_GenVector(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -555,7 +536,6 @@ func Test_client_GenVector(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -582,7 +562,6 @@ func Test_client_GenVector(t *testing.T) {
}
c := &client{
addrs: test.fields.addrs,
cl: test.fields.cl,
c: test.fields.c,
}

Expand All @@ -603,7 +582,6 @@ func Test_client_FilterVector(t *testing.T) {
}
type fields struct {
addrs []string
cl sync.Map
c grpc.Client
}
type want struct {
Expand Down Expand Up @@ -640,7 +618,6 @@ func Test_client_FilterVector(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -660,7 +637,6 @@ func Test_client_FilterVector(t *testing.T) {
},
fields: fields {
addrs: nil,
cl: sync.Map{},
c: nil,
},
want: want{},
Expand All @@ -687,7 +663,6 @@ func Test_client_FilterVector(t *testing.T) {
}
c := &client{
addrs: test.fields.addrs,
cl: test.fields.cl,
c: test.fields.c,
}

Expand Down