Make now runs lint and any unit tests.
Also update vendored voltha-go to add new api updates
Change-Id: I08e11ae043b1db46fed4cc64fddc890a6729dedf
diff --git a/vendor/github.com/opencord/voltha-go/db/kvstore/etcdclient.go b/vendor/github.com/opencord/voltha-go/db/kvstore/etcdclient.go
index e5f6dfe..6935296 100644
--- a/vendor/github.com/opencord/voltha-go/db/kvstore/etcdclient.go
+++ b/vendor/github.com/opencord/voltha-go/db/kvstore/etcdclient.go
@@ -66,15 +66,6 @@
ctx, cancel := context.WithTimeout(context.Background(), duration)
- // DO NOT lock by default; otherwise lock per instructed value
- if len(lock) > 0 && lock[0] {
- session, _ := v3Concurrency.NewSession(c.ectdAPI, v3Concurrency.WithContext(ctx))
- mu := v3Concurrency.NewMutex(session, "/lock"+key)
- mu.Lock(context.Background())
- defer mu.Unlock(context.Background())
- defer session.Close()
- }
-
resp, err := c.ectdAPI.Get(ctx, key, v3Client.WithPrefix())
cancel()
if err != nil {
@@ -95,15 +86,6 @@
ctx, cancel := context.WithTimeout(context.Background(), duration)
- // Lock by default; otherwise lock per instructed value
- if len(lock) > 0 && lock[0] {
- session, _ := v3Concurrency.NewSession(c.ectdAPI, v3Concurrency.WithContext(ctx))
- mu := v3Concurrency.NewMutex(session, "/lock"+key)
- mu.Lock(context.Background())
- defer mu.Unlock(context.Background())
- defer session.Close()
- }
-
resp, err := c.ectdAPI.Get(ctx, key)
cancel()
if err != nil {
@@ -133,15 +115,6 @@
ctx, cancel := context.WithTimeout(context.Background(), duration)
- // Lock by default; otherwise lock per instructed value
- if len(lock) == 0 || lock[0] {
- session, _ := v3Concurrency.NewSession(c.ectdAPI, v3Concurrency.WithContext(ctx))
- mu := v3Concurrency.NewMutex(session, "/lock"+key)
- mu.Lock(context.Background())
- defer mu.Unlock(context.Background())
- defer session.Close()
- }
-
c.writeLock.Lock()
defer c.writeLock.Unlock()
_, err := c.ectdAPI.Put(ctx, key, val)
@@ -170,15 +143,6 @@
ctx, cancel := context.WithTimeout(context.Background(), duration)
- // Lock by default; otherwise lock per instructed value
- if len(lock) == 0 || lock[0] {
- session, _ := v3Concurrency.NewSession(c.ectdAPI, v3Concurrency.WithContext(ctx))
- mu := v3Concurrency.NewMutex(session, "/lock"+key)
- mu.Lock(context.Background())
- defer mu.Unlock(context.Background())
- defer session.Close()
- }
-
defer cancel()
c.writeLock.Lock()
@@ -287,7 +251,7 @@
// ReleaseReservation releases reservation for a specific key.
func (c *EtcdClient) ReleaseReservation(key string) error {
// Get the leaseid using the key
- log.Debugw("Release-reservation", log.Fields{"key":key})
+ log.Debugw("Release-reservation", log.Fields{"key": key})
var ok bool
var leaseID *v3Client.LeaseID
c.writeLock.Lock()
@@ -491,13 +455,14 @@
func (c *EtcdClient) AcquireLock(lockName string, timeout int) error {
duration := GetDuration(timeout)
ctx, cancel := context.WithTimeout(context.Background(), duration)
+ defer cancel()
session, _ := v3Concurrency.NewSession(c.ectdAPI, v3Concurrency.WithContext(ctx))
mu := v3Concurrency.NewMutex(session, "/devicelock_"+lockName)
if err := mu.Lock(context.Background()); err != nil {
+ cancel()
return err
}
c.addLockName(lockName, mu, session)
- cancel()
return nil
}