Skip to content

Commit 3ba3de4

Browse files
authored
Bump google.golang.org/grpc to 1.64.0 (#113)
1 parent 5e49a6d commit 3ba3de4

31 files changed

+106
-98
lines changed

Diff for: .golangci.yaml

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
22
run:
33
tests: true
4-
deadline: 5m
4+
timeout: 5m
55

66
linters-settings:
77
errcheck:
@@ -13,16 +13,16 @@ linters-settings:
1313
threshold: 100
1414
misspell:
1515
locale: US
16-
unused:
17-
check-exported: false
1816
unparam:
1917
check-exported: true
2018

2119
linters:
2220
enable-all: true
2321
disable:
22+
- copyloopvar
2423
- deadcode
2524
- depguard
25+
- execinquery
2626
- exhaustivestruct
2727
- exhaustruct
2828
- forbidigo
@@ -32,10 +32,12 @@ linters:
3232
- golint
3333
- gomnd
3434
- ifshort
35+
- intrange
3536
- interfacer
3637
- ireturn
3738
- lll
3839
- maligned
40+
- mnd
3941
- nolintlint # https://github.com/golangci/golangci-lint/issues/3063
4042
- nonamedreturns
4143
- nosnakecase
@@ -50,11 +52,14 @@ linters:
5052
- wrapcheck
5153

5254
issues:
55+
max-issues-per-linter: 200
56+
max-same-issues: 50
5357
exclude-use-default: false
5458
exclude-rules:
5559
- linters:
5660
- containedctx
5761
- dupl
62+
- err113
5863
- funlen
5964
- goconst
6065
- goerr113

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ MODULE_NAME = grpcmock
22

33
VENDOR_DIR = vendor
44

5-
GOLANGCI_LINT_VERSION ?= v1.55.2
5+
GOLANGCI_LINT_VERSION ?= v1.58.0
66

77
GO ?= go
88
GOLANGCI_LINT ?= $(shell go env GOPATH)/bin/golangci-lint-$(GOLANGCI_LINT_VERSION)

Diff for: client.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ func prepInvoke(ctx context.Context, method string, opts ...InvokeOption) (conte
153153

154154
ctx, dialOpts, callOpts := invokeOptions(ctx, opts...)
155155

156-
conn, err := grpc.DialContext(ctx, addr, dialOpts...)
156+
if addr == "" {
157+
addr = "passthrough://"
158+
}
159+
160+
conn, err := grpc.NewClient(addr, dialOpts...)
157161
if err != nil {
158162
return ctx, nil, "", nil, err
159163
}
@@ -169,7 +173,7 @@ func parseMethod(method string) (string, string, error) {
169173
addr := methodRegex.ReplaceAllString(method, "")
170174

171175
method = strings.Replace(method, addr, "", 1)
172-
method = fmt.Sprintf("/%s", strings.TrimLeft(method, "/"))
176+
method = "/" + strings.TrimLeft(method, "/")
173177

174178
return addr, method, nil
175179
}
@@ -187,6 +191,8 @@ func invokeOptions(ctx context.Context, opts ...InvokeOption) (context.Context,
187191
ctx = metadata.NewOutgoingContext(ctx, metadata.New(cfg.header))
188192
}
189193

194+
// cfg.dialOpts = append([]grpc.DialOption{withDefaultScheme("passthrough")}, cfg.dialOpts...)
195+
190196
return ctx, cfg.dialOpts, cfg.callOpts
191197
}
192198

Diff for: client_test.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package grpcmock_test
33
import (
44
"context"
55
"errors"
6-
"fmt"
76
"io"
87
"net"
98
"testing"
@@ -67,7 +66,7 @@ func TestInvokeUnary_Unimplemented(t *testing.T) {
6766
defer srv.Stop()
6867

6968
go func() {
70-
_ = srv.Serve(l) // nolint: errcheck
69+
_ = srv.Serve(l) //nolint: errcheck
7170
}()
7271

7372
err := grpcmock.InvokeUnary(context.Background(), "grpctest.ItemService/GetItem", nil, nil,
@@ -433,7 +432,7 @@ func TestInvokeBidirectionalStream_Success(t *testing.T) {
433432
return err
434433
}
435434

436-
msg.Name = fmt.Sprintf("Modified %s", msg.GetName())
435+
msg.Name = "Modified " + msg.GetName()
437436

438437
if err := srv.SendMsg(msg); err != nil {
439438
return err
@@ -540,7 +539,7 @@ func TestRecvAll(t *testing.T) {
540539

541540
s.On("RecvMsg", &grpctest.Item{}).Once().
542541
Run(func(args mock.Arguments) {
543-
out := args.Get(0).(*grpctest.Item) // nolint: errcheck
542+
out := args.Get(0).(*grpctest.Item) //nolint: errcheck
544543

545544
proto.Merge(out, i)
546545
}).
@@ -739,7 +738,7 @@ func TestSendAndRecvAll_Success(t *testing.T) {
739738
mockStream: xmock.MockClientStream(func(s *xmock.ClientStream) {
740739
s.On("RecvMsg", mock.Anything).Once().
741740
Run(func(args mock.Arguments) {
742-
out := args.Get(0).(*grpctest.Item) // nolint: errcheck
741+
out := args.Get(0).(*grpctest.Item) //nolint: errcheck
743742

744743
*out = grpctest.Item{Id: 42, Name: "Modified"}
745744
}).

Diff for: go.mod

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
go.nhat.io/aferomock v0.4.0
1111
go.nhat.io/matcher/v2 v2.0.0
1212
go.nhat.io/wait v0.1.0
13-
google.golang.org/grpc v1.63.2
13+
google.golang.org/grpc v1.64.0
1414
google.golang.org/protobuf v1.34.1
1515
)
1616

@@ -27,10 +27,10 @@ require (
2727
github.com/stretchr/objx v0.5.2 // indirect
2828
github.com/yudai/gojsondiff v1.0.0 // indirect
2929
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
30-
golang.org/x/net v0.21.0 // indirect
31-
golang.org/x/sys v0.17.0 // indirect
32-
golang.org/x/text v0.14.0 // indirect
33-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
30+
golang.org/x/net v0.25.0 // indirect
31+
golang.org/x/sys v0.20.0 // indirect
32+
golang.org/x/text v0.15.0 // indirect
33+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
3434
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
3535
gopkg.in/yaml.v3 v3.0.1 // indirect
3636
)

Diff for: go.sum

+10-10
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
110110
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
111111
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
112112
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
113-
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
114-
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
113+
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
114+
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
115115
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
116116
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
117117
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -126,12 +126,12 @@ golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7w
126126
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
127127
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
128128
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
129-
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
130-
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
129+
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
130+
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
131131
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
132132
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
133-
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
134-
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
133+
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
134+
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
135135
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
136136
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
137137
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
@@ -150,15 +150,15 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7
150150
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
151151
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
152152
google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
153-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY=
154-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY=
153+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8=
154+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
155155
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
156156
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
157157
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
158158
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
159159
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
160-
google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM=
161-
google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA=
160+
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
161+
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
162162
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
163163
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
164164
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

Diff for: helper.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package grpcmock
22

33
import (
4-
"fmt"
54
"strings"
65

76
"google.golang.org/grpc"
87
)
98

109
func methodName(v string) string {
11-
return fmt.Sprintf("/%s", strings.TrimLeft(v, "/"))
10+
return "/" + strings.TrimLeft(v, "/")
1211
}
1312

1413
func serviceSorter(services []*grpc.ServiceDesc) ([]*grpc.ServiceDesc, func(i, j int) bool) {

Diff for: invoker/invoker_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package invoker_test
33
import (
44
"context"
55
"errors"
6-
"fmt"
76
"io"
87
"testing"
98
"time"
@@ -32,7 +31,7 @@ func TestInvoker_Invoke_Unary_Unimplemented(t *testing.T) {
3231
defer srv.Stop()
3332

3433
go func() {
35-
_ = srv.Serve(l) // nolint: errcheck
34+
_ = srv.Serve(l) //nolint: errcheck
3635
}()
3736

3837
err := invoker.New(getItemMethod(),
@@ -234,7 +233,7 @@ func TestInvoker_Invoke_BidirectionalStream_Success(t *testing.T) {
234233
return err
235234
}
236235

237-
msg.Name = fmt.Sprintf("Modified %s", msg.GetName())
236+
msg.Name = "Modified " + msg.GetName()
238237

239238
if err := srv.SendMsg(msg); err != nil {
240239
return err

Diff for: matcher/header.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (m HeaderMatcher) Match(ctx context.Context) error {
2828
}
2929

3030
if !matched {
31-
return fmt.Errorf("header %q with value %q expected, %q received", h, m.Expected(), value) // nolint: goerr113
31+
return fmt.Errorf("header %q with value %q expected, %q received", h, m.Expected(), value) //nolint: goerr113
3232
}
3333
}
3434

Diff for: mock.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func MockServer(opts ...ServerOption) ServerMocker {
3535
t.Cleanup(func() {
3636
assert.NoError(t, s.ExpectationsWereMet())
3737

38-
_ = s.Close() // nolint: errcheck
38+
_ = s.Close() //nolint: errcheck
3939
})
4040

4141
return s
@@ -48,7 +48,7 @@ func MockServerWithBufConn(opts ...ServerOption) ServerMockerWithContextDialer {
4848
buf := bufconn.Listen(1024 * 1024)
4949
opts = append(opts, WithListener(buf))
5050

51-
return MockServer(opts...)(t), func(ctx context.Context, s string) (net.Conn, error) {
51+
return MockServer(opts...)(t), func(context.Context, string) (net.Conn, error) {
5252
return buf.Dial()
5353
}
5454
}

Diff for: mock_example_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func ExampleMockServer() {
3838

3939
// Call the service.
4040
out := &grpctest.Item{}
41-
method := fmt.Sprintf("%s/grpctest.ItemService/GetItem", srv.Address())
41+
method := srv.Address() + "/grpctest.ItemService/GetItem"
4242
err := grpcmock.InvokeUnary(context.Background(),
4343
method, &grpctest.GetItemRequest{Id: 41}, out,
4444
grpcmock.WithInsecure(),

Diff for: planner/error.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func NewError(ctx context.Context, expected Expectation, req service.Method, in
7272
if in != nil {
7373
in, err := value.Marshal(in)
7474
if err != nil {
75-
in = fmt.Sprintf("could not read request payload: %s", err.Error())
75+
in = "could not read request payload: " + err.Error()
7676
}
7777

7878
actualPayload = in

Diff for: planner/matcher_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ func mockCreateItemsStreamer() func(t *testing.T) *streamer.ClientStreamer {
709709
return test.MockCreateItemsStreamer(func(s *xmock.ServerStream) {
710710
s.On("RecvMsg", &grpctest.Item{}).Once().
711711
Run(func(args mock.Arguments) {
712-
item := args.Get(0).(*grpctest.Item) // nolint: errcheck
712+
item := args.Get(0).(*grpctest.Item) //nolint: errcheck
713713

714714
proto.Merge(item, test.DefaultItem())
715715
}).

Diff for: request/client_stream.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func (r *ClientStreamRequest) handle(ctx context.Context, in any, out any) error
259259
return status.Error(r.statusCode, r.statusMessage)
260260
}
261261

262-
stream := in.(*streamer.ClientStreamer) // nolint: errcheck
262+
stream := in.(*streamer.ClientStreamer) //nolint: errcheck
263263

264264
resp, err := r.run(ctx, stream)
265265
if err != nil {

Diff for: request/unary.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func NewUnaryRequest(locker sync.Locker, svc *service.Method) *UnaryRequest {
6060
fs: afero.NewOsFs(),
6161
},
6262

63-
run: func(ctx context.Context, in any) (any, error) {
63+
run: func(context.Context, any) (any, error) {
6464
return nil, status.Error(codes.Unimplemented, "not implemented")
6565
},
6666
}

Diff for: resources/docs/SERVER.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func TestServer(t *testing.T) {
7373
)
7474

7575
// Close the server on exit.
76-
defer s.Close(context.Background()) // nolint: errcheck
76+
defer s.Close(context.Background()) //nolint: errcheck
7777

7878
// Call the server and assertions.
7979
}

Diff for: server.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (s *Server) WithPlanner(p planner.Planner) *Server {
9090
defer s.mu.Unlock()
9191

9292
if !s.planner.IsEmpty() {
93-
panic(errors.New("could not change planner: planner is not empty")) // nolint: goerr113
93+
panic(errors.New("could not change planner: planner is not empty")) //nolint: goerr113
9494
}
9595

9696
s.planner = p
@@ -238,7 +238,7 @@ func (s *Server) ExpectationsWereMet() error {
238238
return nil
239239
}
240240

241-
// nolint:goerr113
241+
//nolint:goerr113
242242
return errors.New(sb.String())
243243
}
244244

@@ -272,7 +272,7 @@ func (s *Server) Serve() {
272272

273273
go func(l net.Listener) {
274274
//goland:noinspection GoUnhandledErrorResult
275-
defer closeListener() // nolint: errcheck
275+
defer closeListener() //nolint: errcheck
276276

277277
must.NotFail(srv.Serve(l))
278278
}(s.listener)
@@ -470,7 +470,7 @@ func newStreamHandler(
470470
out any
471471
)
472472

473-
// nolint: exhaustive
473+
//nolint: exhaustive
474474
switch svc.MethodType {
475475
case service.TypeServerStream:
476476
in = xreflect.New(svc.Input)

0 commit comments

Comments
 (0)