From 1de9e1b00d9566c057691eecf71005eac454b55e Mon Sep 17 00:00:00 2001 From: Iskander Sharipov Date: Sat, 28 Jul 2018 23:56:45 +0300 Subject: [PATCH] contrib/recipes: use clientv3.NoLease instead of 0 If we have a named const, it's more readable to use that. Found using https://go-critic.github.io/overview#namedConst-ref --- contrib/recipes/barrier.go | 2 +- contrib/recipes/key.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/recipes/barrier.go b/contrib/recipes/barrier.go index 6e9281721..666c7424c 100644 --- a/contrib/recipes/barrier.go +++ b/contrib/recipes/barrier.go @@ -36,7 +36,7 @@ func NewBarrier(client *v3.Client, key string) *Barrier { // Hold creates the barrier key causing processes to block on Wait. func (b *Barrier) Hold() error { - _, err := newKey(b.client, b.key, 0) + _, err := newKey(b.client, b.key, v3.NoLease) return err } diff --git a/contrib/recipes/key.go b/contrib/recipes/key.go index aea00059a..2d5a32f84 100644 --- a/contrib/recipes/key.go +++ b/contrib/recipes/key.go @@ -47,7 +47,7 @@ func newKV(kv v3.KV, key, val string, leaseID v3.LeaseID) (*RemoteKV, error) { func newUniqueKV(kv v3.KV, prefix string, val string) (*RemoteKV, error) { for { newKey := fmt.Sprintf("%s/%v", prefix, time.Now().UnixNano()) - rev, err := putNewKV(kv, newKey, val, 0) + rev, err := putNewKV(kv, newKey, val, v3.NoLease) if err == nil { return &RemoteKV{kv, newKey, rev, val}, nil }