diff --git a/balancer/grpclb/grpclb_test.go b/balancer/grpclb/grpclb_test.go index 460c852e6..0cada90c7 100644 --- a/balancer/grpclb/grpclb_test.go +++ b/balancer/grpclb/grpclb_test.go @@ -173,10 +173,7 @@ func (s *rpcStats) equal(o *rpcStats) bool { defer s.mu.Unlock() o.mu.Lock() defer o.mu.Unlock() - if !mapsEqual(s.numCallsDropped, o.numCallsDropped) { - return false - } - return true + return mapsEqual(s.numCallsDropped, o.numCallsDropped) } type remoteBalancer struct { diff --git a/examples/features/authentication/oauth/server/main.go b/examples/features/authentication/oauth/server/main.go index bd985e692..3ea94cda7 100644 --- a/examples/features/authentication/oauth/server/main.go +++ b/examples/features/authentication/oauth/server/main.go @@ -96,10 +96,7 @@ func valid(authorization []string) bool { // Perform the token validation here. For the sake of this example, the code // here forgoes any of the usual OAuth2 token validation and instead checks // for a token matching an arbitrary string. - if token != "some-secret-token" { - return false - } - return true + return token == "some-secret-token" } // ensureValidToken ensures a valid token exists within a request's metadata. If diff --git a/examples/features/interceptor/server/main.go b/examples/features/interceptor/server/main.go index 4ab41176d..54ae297c5 100644 --- a/examples/features/interceptor/server/main.go +++ b/examples/features/interceptor/server/main.go @@ -89,10 +89,7 @@ func valid(authorization []string) bool { // Perform the token validation here. For the sake of this example, the code // here forgoes any of the usual OAuth2 token validation and instead checks // for a token matching an arbitrary string. - if token != "some-secret-token" { - return false - } - return true + return token == "some-secret-token" } func unaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { diff --git a/examples/features/load_balancing/client/main.go b/examples/features/load_balancing/client/main.go index 602b6a86c..ff58792bc 100644 --- a/examples/features/load_balancing/client/main.go +++ b/examples/features/load_balancing/client/main.go @@ -111,7 +111,7 @@ type exampleResolver struct { func (r *exampleResolver) start() { addrStrs := r.addrsStore[r.target.Endpoint] - addrs := make([]resolver.Address, len(addrStrs), len(addrStrs)) + addrs := make([]resolver.Address, len(addrStrs)) for i, s := range addrStrs { addrs[i] = resolver.Address{Addr: s} } diff --git a/examples/features/name_resolving/client/main.go b/examples/features/name_resolving/client/main.go index 9feb80913..90c839bcf 100644 --- a/examples/features/name_resolving/client/main.go +++ b/examples/features/name_resolving/client/main.go @@ -119,7 +119,7 @@ type exampleResolver struct { func (r *exampleResolver) start() { addrStrs := r.addrsStore[r.target.Endpoint] - addrs := make([]resolver.Address, len(addrStrs), len(addrStrs)) + addrs := make([]resolver.Address, len(addrStrs)) for i, s := range addrStrs { addrs[i] = resolver.Address{Addr: s} } diff --git a/internal/binarylog/method_logger.go b/internal/binarylog/method_logger.go index b06cdd4d4..160f6e861 100644 --- a/internal/binarylog/method_logger.go +++ b/internal/binarylog/method_logger.go @@ -377,10 +377,7 @@ func metadataKeyOmit(key string) bool { case "grpc-trace-bin": // grpc-trace-bin is special because it's visiable to users. return false } - if strings.HasPrefix(key, "grpc-") { - return true - } - return false + return strings.HasPrefix(key, "grpc-") } func mdToMetadataProto(md metadata.MD) *pb.Metadata { diff --git a/test/channelz_test.go b/test/channelz_test.go index 6b3ffbcab..b15079878 100644 --- a/test/channelz_test.go +++ b/test/channelz_test.go @@ -834,7 +834,7 @@ func doServerSideInitiatedFailedStreamWithClientBreakFlowControl(tc testpb.TestS } // sleep here to make sure header frame being sent before the data frame we write directly below. time.Sleep(10 * time.Millisecond) - payload := make([]byte, 65537, 65537) + payload := make([]byte, 65537) dw.getRawConnWrapper().writeRawFrame(http2.FrameData, 0, tc.(*testServiceClientWrapper).getCurrentStreamID(), payload) if _, err := stream.Recv(); err == nil || status.Code(err) != codes.ResourceExhausted { t.Fatalf("%v.Recv() = %v, want error code: %v", stream, err, codes.ResourceExhausted)