Fix more golint warnings.
authorWard Vandewege <ward@curii.com>
Thu, 1 Oct 2020 23:44:14 +0000 (19:44 -0400)
committerWard Vandewege <ward@curii.com>
Thu, 1 Oct 2020 23:44:14 +0000 (19:44 -0400)
No issue #

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

lib/dispatchcloud/test/queue.go
sdk/go/keepclient/keepclient.go
services/keep-web/cache.go
services/keepstore/volume.go

index 8a8f686e168ff6372f0c19813d31cd2ced26509c..3598ec6da05baf23d3eaed302ec8db603f38e96c 100644 (file)
@@ -172,12 +172,11 @@ func (q *Queue) Notify(upd arvados.Container) bool {
                        if allowContainerUpdate[ctr.State][upd.State] {
                                q.Containers[i] = upd
                                return true
-                       } else {
-                               if q.Logger != nil {
-                                       q.Logger.WithField("ContainerUUID", ctr.UUID).Infof("test.Queue rejected update from %s to %s", ctr.State, upd.State)
-                               }
-                               return false
                        }
+                       if q.Logger != nil {
+                               q.Logger.WithField("ContainerUUID", ctr.UUID).Infof("test.Queue rejected update from %s to %s", ctr.State, upd.State)
+                       }
+                       return false
                }
        }
        q.Containers = append(q.Containers, upd)
index 13f8f957714e984a4ef1d933cd1b901e64fd7a77..8eff377ce651513cc6170848d18ea25cd260d5fb 100644 (file)
@@ -492,9 +492,8 @@ func (kc *KeepClient) getSortedRoots(locator string) []string {
 func (kc *KeepClient) cache() *BlockCache {
        if kc.BlockCache != nil {
                return kc.BlockCache
-       } else {
-               return DefaultBlockCache
        }
+       return DefaultBlockCache
 }
 
 func (kc *KeepClient) ClearBlockCache() {
@@ -575,9 +574,8 @@ var reqIDGen = httpserver.IDGenerator{Prefix: "req-"}
 func (kc *KeepClient) getRequestID() string {
        if kc.RequestID != "" {
                return kc.RequestID
-       } else {
-               return reqIDGen.Next()
        }
+       return reqIDGen.Next()
 }
 
 type Locator struct {
index 2ff2136ed7191a1d0229fbaced99f520b87212ce..5400f694fd373e37cd87a53179242b6693d87985 100644 (file)
@@ -224,13 +224,12 @@ func (c *cache) Get(arv *arvadosclient.ArvadosClient, targetID string, forceRelo
                                })
                        }
                        return collection, err
-               } else {
-                       // PDH changed, but now we know we have
-                       // permission -- and maybe we already have the
-                       // new PDH in the cache.
-                       if coll := c.lookupCollection(arv.ApiToken + "\000" + current.PortableDataHash); coll != nil {
-                               return coll, nil
-                       }
+               }
+               // PDH changed, but now we know we have
+               // permission -- and maybe we already have the
+               // new PDH in the cache.
+               if coll := c.lookupCollection(arv.ApiToken + "\000" + current.PortableDataHash); coll != nil {
+                       return coll, nil
                }
        }
 
index 5a277b6007a7bdb7ff4ed2db04ddcb7b44606e5d..4d8a0aec7ac06ec4f38e815fe0d23447723e38fa 100644 (file)
@@ -353,9 +353,8 @@ func (vm *RRVolumeManager) Mounts() []*VolumeMount {
 func (vm *RRVolumeManager) Lookup(uuid string, needWrite bool) *VolumeMount {
        if mnt, ok := vm.mountMap[uuid]; ok && (!needWrite || !mnt.ReadOnly) {
                return mnt
-       } else {
-               return nil
        }
+       return nil
 }
 
 // AllReadable returns an array of all readable volumes