From 95bbf69653095856fb195bae908cc701ee089939 Mon Sep 17 00:00:00 2001 From: Karsten Weiss Date: Sun, 15 Apr 2018 12:43:34 +0200 Subject: [PATCH] Remove redundant return statements (gosimple) This fixes: balancer/base/balancer.go:149:2: redundant return statement (S1023) balancer_v1_wrapper.go:260:2: redundant return statement (S1023) balancer_v1_wrapper.go:273:2: redundant return statement (S1023) balancer_v1_wrapper.go:285:2: redundant return statement (S1023) benchmark/benchmark.go:68:2: redundant return statement (S1023) clientconn.go:1461:2: redundant return statement (S1023) grpclb.go:223:2: redundant return statement (S1023) grpclb.go:260:2: redundant return statement (S1023) grpclb_util.go:201:2: redundant return statement (S1023) rpc_util.go:278:50: redundant return statement (S1023) rpc_util.go:296:56: redundant return statement (S1023) rpc_util.go:314:56: redundant return statement (S1023) rpc_util.go:333:53: redundant return statement (S1023) rpc_util.go:354:52: redundant return statement (S1023) rpc_util.go:387:56: redundant return statement (S1023) rpc_util.go:416:53: redundant return statement (S1023) stream.go:651:2: redundant return statement (S1023) --- balancer/base/balancer.go | 1 - balancer_v1_wrapper.go | 3 --- benchmark/benchmark.go | 1 - clientconn.go | 1 - grpclb.go | 2 -- grpclb_util.go | 1 - rpc_util.go | 14 +++++++------- stream.go | 1 - 8 files changed, 7 insertions(+), 17 deletions(-) diff --git a/balancer/base/balancer.go b/balancer/base/balancer.go index 1e962b72..23d13511 100644 --- a/balancer/base/balancer.go +++ b/balancer/base/balancer.go @@ -146,7 +146,6 @@ func (b *baseBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectiv } b.cc.UpdateBalancerState(b.state, b.picker) - return } // Close is a nop because base balancer doesn't have internal state to clean up, diff --git a/balancer_v1_wrapper.go b/balancer_v1_wrapper.go index faabf87d..b7abc6b7 100644 --- a/balancer_v1_wrapper.go +++ b/balancer_v1_wrapper.go @@ -257,7 +257,6 @@ func (bw *balancerWrapper) HandleSubConnStateChange(sc balancer.SubConn, s conne // Remove state for this sc. delete(bw.connSt, sc) } - return } func (bw *balancerWrapper) HandleResolvedAddrs([]resolver.Address, error) { @@ -270,7 +269,6 @@ func (bw *balancerWrapper) HandleResolvedAddrs([]resolver.Address, error) { } // There should be a resolver inside the balancer. // All updates here, if any, are ignored. - return } func (bw *balancerWrapper) Close() { @@ -282,7 +280,6 @@ func (bw *balancerWrapper) Close() { close(bw.startCh) } bw.balancer.Close() - return } // The picker is the balancerWrapper itself. diff --git a/benchmark/benchmark.go b/benchmark/benchmark.go index 956ae35f..dc5d97af 100644 --- a/benchmark/benchmark.go +++ b/benchmark/benchmark.go @@ -65,7 +65,6 @@ func setPayload(p *testpb.Payload, t testpb.PayloadType, size int) { } p.Type = t p.Body = body - return } func newPayload(t testpb.PayloadType, size int) *testpb.Payload { diff --git a/clientconn.go b/clientconn.go index 44fa7e24..9873b803 100644 --- a/clientconn.go +++ b/clientconn.go @@ -1458,7 +1458,6 @@ func (ac *addrConn) tearDown(err error) { if channelz.IsOn() { channelz.RemoveEntry(ac.channelzID) } - return } func (ac *addrConn) getState() connectivity.State { diff --git a/grpclb.go b/grpclb.go index e8a92d12..9761dfbb 100644 --- a/grpclb.go +++ b/grpclb.go @@ -220,7 +220,6 @@ func (lb *lbBalancer) regeneratePicker() { subConns: readySCs, stats: lb.clientStats, } - return } func (lb *lbBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivity.State) { @@ -257,7 +256,6 @@ func (lb *lbBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivi } lb.cc.UpdateBalancerState(lb.state, lb.picker) - return } // fallbackToBackendsAfter blocks for fallbackTimeout and falls back to use diff --git a/grpclb_util.go b/grpclb_util.go index 46ba2747..063ba9d8 100644 --- a/grpclb_util.go +++ b/grpclb_util.go @@ -198,7 +198,6 @@ func (ccc *lbCacheClientConn) RemoveSubConn(sc balancer.SubConn) { entry.abortDeleting = true } } - return } func (ccc *lbCacheClientConn) UpdateBalancerState(s connectivity.State, p balancer.Picker) { diff --git a/rpc_util.go b/rpc_util.go index 1bd8bb23..308a446c 100644 --- a/rpc_util.go +++ b/rpc_util.go @@ -275,7 +275,7 @@ func (o FailFastCallOption) before(c *callInfo) error { c.failFast = o.FailFast return nil } -func (o FailFastCallOption) after(c *callInfo) { return } +func (o FailFastCallOption) after(c *callInfo) {} // MaxCallRecvMsgSize returns a CallOption which sets the maximum message size the client can receive. func MaxCallRecvMsgSize(s int) CallOption { @@ -293,7 +293,7 @@ func (o MaxRecvMsgSizeCallOption) before(c *callInfo) error { c.maxReceiveMessageSize = &o.MaxRecvMsgSize return nil } -func (o MaxRecvMsgSizeCallOption) after(c *callInfo) { return } +func (o MaxRecvMsgSizeCallOption) after(c *callInfo) {} // MaxCallSendMsgSize returns a CallOption which sets the maximum message size the client can send. func MaxCallSendMsgSize(s int) CallOption { @@ -311,7 +311,7 @@ func (o MaxSendMsgSizeCallOption) before(c *callInfo) error { c.maxSendMessageSize = &o.MaxSendMsgSize return nil } -func (o MaxSendMsgSizeCallOption) after(c *callInfo) { return } +func (o MaxSendMsgSizeCallOption) after(c *callInfo) {} // PerRPCCredentials returns a CallOption that sets credentials.PerRPCCredentials // for a call. @@ -330,7 +330,7 @@ func (o PerRPCCredsCallOption) before(c *callInfo) error { c.creds = o.Creds return nil } -func (o PerRPCCredsCallOption) after(c *callInfo) { return } +func (o PerRPCCredsCallOption) after(c *callInfo) {} // UseCompressor returns a CallOption which sets the compressor used when // sending the request. If WithCompressor is also set, UseCompressor has @@ -351,7 +351,7 @@ func (o CompressorCallOption) before(c *callInfo) error { c.compressorType = o.CompressorType return nil } -func (o CompressorCallOption) after(c *callInfo) { return } +func (o CompressorCallOption) after(c *callInfo) {} // CallContentSubtype returns a CallOption that will set the content-subtype // for a call. For example, if content-subtype is "json", the Content-Type over @@ -384,7 +384,7 @@ func (o ContentSubtypeCallOption) before(c *callInfo) error { c.contentSubtype = o.ContentSubtype return nil } -func (o ContentSubtypeCallOption) after(c *callInfo) { return } +func (o ContentSubtypeCallOption) after(c *callInfo) {} // CallCustomCodec returns a CallOption that will set the given Codec to be // used for all request and response messages for a call. The result of calling @@ -413,7 +413,7 @@ func (o CustomCodecCallOption) before(c *callInfo) error { c.codec = o.Codec return nil } -func (o CustomCodecCallOption) after(c *callInfo) { return } +func (o CustomCodecCallOption) after(c *callInfo) {} // The format of the payload: compressed or not? type payloadFormat uint8 diff --git a/stream.go b/stream.go index 75a4e8d4..0c33a122 100644 --- a/stream.go +++ b/stream.go @@ -648,7 +648,6 @@ func (ss *serverStream) SetTrailer(md metadata.MD) { return } ss.s.SetTrailer(md) - return } func (ss *serverStream) SendMsg(m interface{}) (err error) {