Browse Source

clientv3: clean up code format

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 years ago
parent
commit
90a5da18cf

+ 1 - 1
clientv3/balancer/resolver/endpoint/endpoint.go

@@ -157,7 +157,7 @@ func (b *builder) close(id string) {
 	b.mu.Unlock()
 }
 
-func (r *builder) Scheme() string {
+func (b *builder) Scheme() string {
 	return scheme
 }
 

+ 1 - 1
clientv3/integration/metrics_test.go

@@ -39,7 +39,7 @@ func TestV3ClientMetrics(t *testing.T) {
 	defer testutil.AfterTest(t)
 
 	var (
-		addr string = "localhost:27989"
+		addr = "localhost:27989"
 		ln   net.Listener
 		err  error
 	)

+ 2 - 2
clientv3/lease.go

@@ -288,7 +288,7 @@ func (l *lessor) KeepAlive(ctx context.Context, id LeaseID) (<-chan *LeaseKeepAl
 	}
 	l.mu.Unlock()
 
-	go l.keepAliveCtxCloser(id, ctx, ka.donec)
+	go l.keepAliveCtxCloser(ctx, id, ka.donec)
 	l.firstKeepAliveOnce.Do(func() {
 		go l.recvKeepAliveLoop()
 		go l.deadlineLoop()
@@ -320,7 +320,7 @@ func (l *lessor) Close() error {
 	return nil
 }
 
-func (l *lessor) keepAliveCtxCloser(id LeaseID, ctx context.Context, donec <-chan struct{}) {
+func (l *lessor) keepAliveCtxCloser(ctx context.Context, id LeaseID, donec <-chan struct{}) {
 	select {
 	case <-donec:
 		return

+ 1 - 1
clientv3/options.go

@@ -47,7 +47,7 @@ var (
 	// client-side streaming retry limit, only applied to requests where server responds with
 	// a error code clearly indicating it was unable to process the request such as codes.Unavailable.
 	// If set to 0, retry is disabled.
-	defaultStreamMaxRetries uint = ^uint(0) // max uint
+	defaultStreamMaxRetries = uint(^uint(0)) // max uint
 
 	// client-side retry backoff wait between requests.
 	defaultBackoffWaitBetween = 25 * time.Millisecond

+ 4 - 4
clientv3/retry_interceptor.go

@@ -46,7 +46,7 @@ func (c *Client) unaryClientInterceptor(logger *zap.Logger, optFuncs ...retryOpt
 		}
 		var lastErr error
 		for attempt := uint(0); attempt < callOpts.max; attempt++ {
-			if err := waitRetryBackoff(attempt, ctx, callOpts); err != nil {
+			if err := waitRetryBackoff(ctx, attempt, callOpts); err != nil {
 				return err
 			}
 			lastErr = invoker(ctx, method, req, reply, cc, grpcOpts...)
@@ -173,7 +173,7 @@ func (s *serverStreamingRetryingStream) RecvMsg(m interface{}) error {
 	}
 	// We start off from attempt 1, because zeroth was already made on normal SendMsg().
 	for attempt := uint(1); attempt < s.callOpts.max; attempt++ {
-		if err := waitRetryBackoff(attempt, s.ctx, s.callOpts); err != nil {
+		if err := waitRetryBackoff(s.ctx, attempt, s.callOpts); err != nil {
 			return err
 		}
 		newStream, err := s.reestablishStreamAndResendBuffer(s.ctx)
@@ -243,8 +243,8 @@ func (s *serverStreamingRetryingStream) reestablishStreamAndResendBuffer(callCtx
 	return newStream, nil
 }
 
-func waitRetryBackoff(attempt uint, ctx context.Context, callOpts *options) error {
-	var waitTime time.Duration = 0
+func waitRetryBackoff(ctx context.Context, attempt uint, callOpts *options) error {
+	waitTime := time.Duration(0)
 	if attempt > 0 {
 		waitTime = callOpts.backoffFunc(attempt)
 	}