Skip to content

Commit

Permalink
fix golang lint
Browse files Browse the repository at this point in the history
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
  • Loading branch information
YaoZengzeng committed Jun 18, 2024
1 parent d1551f5 commit 1438e87
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ jobs:
args: "--config=common/config/.golangci.yaml --out-format colored-line-number"
skip-pkg-cache: true

- name: Go Test
run: |
sudo env LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:$GITHUB_WORKSPACE/api/v2-c:$GITHUB_WORKSPACE/bpf/deserialization_to_bpf_map PKG_CONFIG_PATH=$GITHUB_WORKSPACE/mk go test -v -vet=off -coverprofile=coverage.out ./pkg/...
- name: E2E Test
run: |
make e2e
- name: Go Test
run: |
sudo env LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:$GITHUB_WORKSPACE/api/v2-c:$GITHUB_WORKSPACE/bpf/deserialization_to_bpf_map PKG_CONFIG_PATH=$GITHUB_WORKSPACE/mk go test -v -vet=off -coverprofile=coverage.out ./pkg/...
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
Expand Down
2 changes: 1 addition & 1 deletion cniplugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ const (
)

func main() {
skel.PluginMain(plugin.CmdAdd, plugin.CmdCheck, plugin.CmdDelete, version.All,
skel.PluginMainFuncs(skel.CNIFuncs{Add: plugin.CmdAdd, Check: plugin.CmdCheck, Del: plugin.CmdDelete}, version.All,
fmt.Sprintf("CNI plugin kmesh-cni %v", CNI_PLUGIN_VERSION))
}
9 changes: 3 additions & 6 deletions pkg/controller/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ func TestRecoverConnection(t *testing.T) {
} else {
// returns a fake grpc connection
mockDiscovery := xdstest.NewXdsServer(t)
return grpc.Dial("buffcon",
return grpc.NewClient("buffcon",
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithBlock(),
grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) {
return mockDiscovery.Listener.Dial()
}))
Expand All @@ -70,9 +69,8 @@ func TestClientResponseProcess(t *testing.T) {
defer netPatches.Reset()
netPatches.ApplyFunc(nets.GrpcConnect, func(addr string) (*grpc.ClientConn, error) {
mockDiscovery := xdstest.NewXdsServer(t)
return grpc.Dial("buffcon",
return grpc.NewClient("buffcon",
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithBlock(),
grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) {
return mockDiscovery.Listener.Dial()
}))
Expand Down Expand Up @@ -117,9 +115,8 @@ func TestClientResponseProcess(t *testing.T) {
defer netPatches.Reset()
netPatches.ApplyFunc(nets.GrpcConnect, func(addr string) (*grpc.ClientConn, error) {
mockDiscovery := xdstest.NewXdsServer(t)
return grpc.Dial("buffcon",
return grpc.NewClient("buffcon",
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithBlock(),
grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) {
return mockDiscovery.Listener.Dial()
}))
Expand Down
3 changes: 1 addition & 2 deletions pkg/controller/xdstest/fake_xdsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ type XDSClient struct {
}

func NewClient(xdsServer *XDSServer) (*XDSClient, error) {
conn, err := grpc.Dial("buffcon",
conn, err := grpc.NewClient("buffcon",
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithBlock(),
grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) {
return xdsServer.Listener.Dial()
}))
Expand Down
2 changes: 1 addition & 1 deletion pkg/nets/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func GrpcConnect(addr string) (*grpc.ClientConn, error) {
}
opts = append(opts, grpc.WithPerRPCCredentials(caclient.NewDefaultTokenProvider(o)))

if conn, err = grpc.Dial(addr, opts...); err != nil {
if conn, err = grpc.NewClient(addr, opts...); err != nil {
return nil, err
}

Expand Down

0 comments on commit 1438e87

Please sign in to comment.