Skip to content

Commit

Permalink
Bump google.golang.org/grpc from 1.60.0 to 1.60.1 (#95)
Browse files Browse the repository at this point in the history
* Bump google.golang.org/grpc from 1.60.0 to 1.60.1

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.60.0 to 1.60.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.60.0...v1.60.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix broken checks

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: nhatthm <thmnhat@gmail.com>
  • Loading branch information
dependabot[bot] and nhatthm authored Dec 19, 2023
1 parent 2b51dff commit 9577e3a
Show file tree
Hide file tree
Showing 75 changed files with 554 additions and 551 deletions.
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ linters:
- scopelint
- structcheck
- tagliatelle
- testifylint
- testpackage
- varcheck
- varnamelen
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ MODULE_NAME = grpcmock

VENDOR_DIR = vendor

GOLANGCI_LINT_VERSION ?= v1.53.3
GOLANGCI_LINT_VERSION ?= v1.55.2

GO ?= go
GOLANGCI_LINT ?= $(shell go env GOPATH)/bin/golangci-lint-$(GOLANGCI_LINT_VERSION)
Expand Down
8 changes: 4 additions & 4 deletions assert/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

// EqualMessage asserts that two proto messages are equal.
func EqualMessage(t assert.TestingT, expected, actual proto.Message, msgAndArgs ...interface{}) bool {
func EqualMessage(t assert.TestingT, expected, actual proto.Message, msgAndArgs ...any) bool {
if proto.Equal(expected, actual) {
return true
}
Expand All @@ -20,7 +20,7 @@ func EqualMessage(t assert.TestingT, expected, actual proto.Message, msgAndArgs
}

// EqualError asserts that two grpc errors are equal.
func EqualError(t assert.TestingT, expected, actual error, msgAndArgs ...interface{}) bool {
func EqualError(t assert.TestingT, expected, actual error, msgAndArgs ...any) bool {
if st, _ := status.FromError(actual); st != nil {
actual = status.Error(st.Code(), sanitizeErrorMessage(st.Message()))
}
Expand All @@ -29,7 +29,7 @@ func EqualError(t assert.TestingT, expected, actual error, msgAndArgs ...interfa
}

// EqualErrorMessage asserts that the grpc error message is equal.
func EqualErrorMessage(t assert.TestingT, actual error, expected string, msgAndArgs ...interface{}) bool {
func EqualErrorMessage(t assert.TestingT, actual error, expected string, msgAndArgs ...any) bool {
if st, _ := status.FromError(actual); st != nil {
actual = status.Error(st.Code(), sanitizeErrorMessage(st.Message()))
}
Expand All @@ -38,7 +38,7 @@ func EqualErrorMessage(t assert.TestingT, actual error, expected string, msgAndA
}

// JSONEq compares 2 json objects.
func JSONEq(t assert.TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
func JSONEq(t assert.TestingT, expected, actual any, msgAndArgs ...any) bool {
if !assert.IsType(t, expected, actual) {
return false
}
Expand Down
18 changes: 9 additions & 9 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ type InvokeOption func(c *invokeConfig)
func InvokeUnary(
ctx context.Context,
method string,
in interface{},
out interface{},
in any,
out any,
opts ...InvokeOption,
) error {
ctx, conn, method, callOpts, err := prepInvoke(ctx, method, opts...)
Expand All @@ -59,10 +59,10 @@ func InvokeUnary(
}

// InvokeServerStream invokes a server-stream method.
func InvokeServerStream(
func InvokeServerStream( //nolint: dupl
ctx context.Context,
method string,
in interface{},
in any,
handle ClientStreamHandler,
opts ...InvokeOption,
) error {
Expand Down Expand Up @@ -90,11 +90,11 @@ func InvokeServerStream(
}

// InvokeClientStream invokes a client-stream method.
func InvokeClientStream(
func InvokeClientStream( //nolint: dupl
ctx context.Context,
method string,
handle ClientStreamHandler,
out interface{},
out any,
opts ...InvokeOption,
) error {
ctx, conn, method, callOpts, err := prepInvoke(ctx, method, opts...)
Expand Down Expand Up @@ -244,21 +244,21 @@ func WithCallOptions(opts ...grpc.CallOption) InvokeOption {
}

// SendAll sends everything to the stream.
func SendAll(in interface{}) ClientStreamHandler {
func SendAll(in any) ClientStreamHandler {
return func(s grpc.ClientStream) error {
return stream.SendAll(s, in)
}
}

// RecvAll reads everything from the stream and put into the output.
func RecvAll(out interface{}) ClientStreamHandler {
func RecvAll(out any) ClientStreamHandler {
return func(s grpc.ClientStream) error {
return stream.RecvAll(s, out)
}
}

// SendAndRecvAll sends and receives messages to and from grpc server in turn until server sends the io.EOF.
func SendAndRecvAll(in interface{}, out interface{}) ClientStreamHandler {
func SendAndRecvAll(in any, out any) ClientStreamHandler {
return func(s grpc.ClientStream) error {
return stream.SendAndRecvAll(s, in, out)
}
Expand Down
10 changes: 5 additions & 5 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestInvokeUnary_Success(t *testing.T) {
actualRequest = request

response := test.BuildItem().
WithID(request.Id).
WithID(request.GetId()).
WithLocale(locale).
WithName("Foobar").
New()
Expand Down Expand Up @@ -433,7 +433,7 @@ func TestInvokeBidirectionalStream_Success(t *testing.T) {
return err
}

msg.Name = fmt.Sprintf("Modified %s", msg.Name)
msg.Name = fmt.Sprintf("Modified %s", msg.GetName())

if err := srv.SendMsg(msg); err != nil {
return err
Expand Down Expand Up @@ -480,7 +480,7 @@ func TestSendAll(t *testing.T) {
testCases := []struct {
scenario string
mockStream xmock.ClientStreamMocker
input interface{}
input any
expectedError string
}{
{
Expand Down Expand Up @@ -554,8 +554,8 @@ func TestRecvAll(t *testing.T) {
testCases := []struct {
scenario string
mockStream xmock.ClientStreamMocker
output interface{}
expectedOutput interface{}
output any
expectedOutput any
expectedError string
}{
{
Expand Down
18 changes: 9 additions & 9 deletions format/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ func ExpectedRequest(w io.Writer, svc service.Method, header xmatcher.HeaderMatc

// ExpectedRequestTimes formats an expected request with total and remaining calls.
func ExpectedRequestTimes(w io.Writer, svc service.Method, header xmatcher.HeaderMatcher, payload matcher.Matcher, totalCalls, remainingCalls int) {
expectedHeader := map[string]interface{}(nil)
expectedHeader := map[string]any(nil)

if header != nil {
expectedHeader = make(map[string]interface{}, len(header))
expectedHeader = make(map[string]any, len(header))

for k, v := range header {
expectedHeader[k] = v
Expand All @@ -37,10 +37,10 @@ func ExpectedRequestTimes(w io.Writer, svc service.Method, header xmatcher.Heade
}

// Request formats a request.
func Request(w io.Writer, svc service.Method, header map[string]string, payload interface{}) {
interfaceHeader := map[string]interface{}(nil)
func Request(w io.Writer, svc service.Method, header map[string]string, payload any) {
interfaceHeader := map[string]any(nil)
if header != nil {
interfaceHeader = make(map[string]interface{}, len(header))
interfaceHeader = make(map[string]any, len(header))

for k, v := range header {
interfaceHeader[k] = v
Expand All @@ -50,7 +50,7 @@ func Request(w io.Writer, svc service.Method, header map[string]string, payload
formatRequestTimes(w, svc, interfaceHeader, payload, 0, 0)
}

func formatRequestTimes(w io.Writer, svc service.Method, header map[string]interface{}, payload interface{}, totalCalls, remainingCalls int) {
func formatRequestTimes(w io.Writer, svc service.Method, header map[string]any, payload any, totalCalls, remainingCalls int) {
_, _ = fmt.Fprintf(w, "%s %s", svc.MethodType, svc.FullName())

if remainingCalls > 0 && (totalCalls != 0 || remainingCalls != 1) {
Expand Down Expand Up @@ -87,7 +87,7 @@ func formatRequestTimes(w io.Writer, svc service.Method, header map[string]inter
}
}

func formatValueInline(v interface{}) string {
func formatValueInline(v any) string {
if v == nil {
return "<nil>"
}
Expand Down Expand Up @@ -121,7 +121,7 @@ func formatValueInline(v interface{}) string {
}
}

func formatType(v interface{}) string {
func formatType(v any) string {
if xreflect.IsNil(v) {
return ""
}
Expand All @@ -145,7 +145,7 @@ func formatType(v interface{}) string {
}

// nolint: cyclop
func formatValue(v interface{}) string {
func formatValue(v any) string {
if v == nil {
return "<nil>"
}
Expand Down
6 changes: 3 additions & 3 deletions format/format_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestFormatValueInline(t *testing.T) {

testCases := []struct {
scenario string
input interface{}
input any
expected string
}{
{
Expand Down Expand Up @@ -93,7 +93,7 @@ func TestFormatType(t *testing.T) {

testCases := []struct {
scenario string
input interface{}
input any
expected string
}{
{
Expand Down Expand Up @@ -152,7 +152,7 @@ func TestFormatValue(t *testing.T) {

testCases := []struct {
scenario string
input interface{}
input any
expected string
}{
{
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
go.nhat.io/aferomock v0.4.0
go.nhat.io/matcher/v2 v2.0.0
go.nhat.io/wait v0.1.0
google.golang.org/grpc v1.60.0
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.31.0
)

Expand All @@ -25,13 +25,13 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/stretchr/objx v0.5.1 // indirect
github.com/yudai/gojsondiff v1.0.0 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
12 changes: 7 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,16 @@ github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNo
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0=
github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/swaggest/assertjson v1.9.0 h1:dKu0BfJkIxv/xe//mkCrK5yZbs79jL7OVf9Ija7o2xQ=
Expand Down Expand Up @@ -156,15 +158,15 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 h1:/jFB8jK5R3Sq3i/lmeZO0cATSzFfZaJq1J2Euan3XKU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0/go.mod h1:FUoWkonphQm3RhTS+kOEhF8h0iDpm4tdXolVCeZ9KKA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k=
google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU=
google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
Expand Down
4 changes: 2 additions & 2 deletions invoker/invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type Invoker struct {
method string
methodType service.Type

input interface{}
output interface{}
input any
output any
handle grpcmock.ClientStreamHandler

options []grpcmock.InvokeOption
Expand Down
4 changes: 2 additions & 2 deletions invoker/invoker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestInvoker_Invoke_Unary_Success(t *testing.T) {
actualRequest = request

response := &grpctest.Item{
Id: request.Id,
Id: request.GetId(),
Locale: locale,
Name: "Foobar",
}
Expand Down Expand Up @@ -234,7 +234,7 @@ func TestInvoker_Invoke_BidirectionalStream_Success(t *testing.T) {
return err
}

msg.Name = fmt.Sprintf("Modified %s", msg.Name)
msg.Name = fmt.Sprintf("Modified %s", msg.GetName())

if err := srv.SendMsg(msg); err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions invoker/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func WithAddress(addr string) Option {
}

// WithInput sets the input for the invoker.
func WithInput(input interface{}) Option {
func WithInput(input any) Option {
return func(i *Invoker) {
i.input = input
}
Expand All @@ -31,7 +31,7 @@ func WithInputStreamHandler(h grpcmock.ClientStreamHandler) Option {
}

// WithOutput sets the output for the invoker.
func WithOutput(output interface{}) Option {
func WithOutput(output any) Option {
return func(i *Invoker) {
i.output = output
}
Expand Down
4 changes: 2 additions & 2 deletions matcher/fn.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "go.nhat.io/matcher/v2"
var _ matcher.Matcher = (*FnMatcher)(nil)

// MatchFn is the match function to be used in FnMatcher.
type MatchFn = func(v interface{}) (bool, error)
type MatchFn = func(v any) (bool, error)

// FnMatcher is a matcher that call itself.
type FnMatcher struct {
Expand All @@ -14,7 +14,7 @@ type FnMatcher struct {
}

// Match satisfies the matcher.Matcher interface.
func (f FnMatcher) Match(actual interface{}) (bool, error) {
func (f FnMatcher) Match(actual any) (bool, error) {
return f.match(actual)
}

Expand Down
6 changes: 3 additions & 3 deletions matcher/fn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ func TestFn(t *testing.T) {

testCases := []struct {
scenario string
match func(interface{}) (bool, error)
match func(any) (bool, error)
expectedResult bool
expectedError error
}{
{
scenario: "error",
match: func(interface{}) (bool, error) {
match: func(any) (bool, error) {
return false, errors.New("match error")
},
expectedError: errors.New("match error"),
},
{
scenario: "success",
match: func(interface{}) (bool, error) {
match: func(any) (bool, error) {
return true, nil
},
expectedResult: true,
Expand Down
Loading

0 comments on commit 9577e3a

Please sign in to comment.