From 50a6bbe6b9294769ffcff05d3b4f54843b63ada8 Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Sat, 28 Aug 2021 12:11:11 +0800 Subject: [PATCH] format coding style (#970) --- zrpc/internal/codes/accept_test.go | 1 - zrpc/internal/serverinterceptors/timeoutinterceptor.go | 4 ++-- zrpc/internal/serverinterceptors/timeoutinterceptor_test.go | 5 +++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/zrpc/internal/codes/accept_test.go b/zrpc/internal/codes/accept_test.go index 00750126..ddca4a08 100644 --- a/zrpc/internal/codes/accept_test.go +++ b/zrpc/internal/codes/accept_test.go @@ -9,7 +9,6 @@ import ( ) func TestAccept(t *testing.T) { - tests := []struct { name string err error diff --git a/zrpc/internal/serverinterceptors/timeoutinterceptor.go b/zrpc/internal/serverinterceptors/timeoutinterceptor.go index 67fc5d1a..4d168673 100644 --- a/zrpc/internal/serverinterceptors/timeoutinterceptor.go +++ b/zrpc/internal/serverinterceptors/timeoutinterceptor.go @@ -3,14 +3,14 @@ package serverinterceptors import ( "context" "fmt" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" "runtime/debug" "strings" "sync" "time" "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) // UnaryTimeoutInterceptor returns a func that sets timeout to incoming unary requests. diff --git a/zrpc/internal/serverinterceptors/timeoutinterceptor_test.go b/zrpc/internal/serverinterceptors/timeoutinterceptor_test.go index e483d0c9..2c18411b 100644 --- a/zrpc/internal/serverinterceptors/timeoutinterceptor_test.go +++ b/zrpc/internal/serverinterceptors/timeoutinterceptor_test.go @@ -2,14 +2,14 @@ package serverinterceptors import ( "context" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" "sync" "testing" "time" "github.com/stretchr/testify/assert" "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) func TestUnaryTimeoutInterceptor(t *testing.T) { @@ -70,6 +70,7 @@ func TestUnaryTimeoutInterceptor_timeoutExpire(t *testing.T) { wg.Wait() assert.EqualValues(t, status.Error(codes.DeadlineExceeded, context.DeadlineExceeded.Error()), err) } + func TestUnaryTimeoutInterceptor_cancel(t *testing.T) { const timeout = time.Minute * 10 interceptor := UnaryTimeoutInterceptor(timeout)