Fix more golint warnings.
authorWard Vandewege <ward@curii.com>
Fri, 13 Nov 2020 01:02:56 +0000 (20:02 -0500)
committerNico Cesar <nico@nicocesar.com>
Mon, 16 Nov 2020 19:10:44 +0000 (14:10 -0500)
No issue #

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

sdk/go/keepclient/keepclient.go
sdk/go/keepclient/root_sorter_test.go

index d600322e6a8463a7a7a66577683aad6c697fa031..ec56e902c88d1ea8bcf484976d58d5bb2aae589e 100644 (file)
@@ -90,7 +90,7 @@ type HTTPClient interface {
        Do(*http.Request) (*http.Response, error)
 }
 
-// Information about Arvados and Keep servers.
+// KeepClient holds information about Arvados and Keep servers.
 type KeepClient struct {
        Arvados            *arvadosclient.ArvadosClient
        Want_replicas      int
@@ -333,7 +333,7 @@ func (kc *KeepClient) LocalLocator(locator string) (string, error) {
        return loc, nil
 }
 
-// Get() retrieves a block, given a locator. Returns a reader, the
+// Get retrieves a block, given a locator. Returns a reader, the
 // expected data length, the URL the block is being fetched from, and
 // an error.
 //
@@ -345,13 +345,13 @@ func (kc *KeepClient) Get(locator string) (io.ReadCloser, int64, string, error)
        return rdr, size, url, err
 }
 
-// ReadAt() retrieves a portion of block from the cache if it's
+// ReadAt retrieves a portion of block from the cache if it's
 // present, otherwise from the network.
 func (kc *KeepClient) ReadAt(locator string, p []byte, off int) (int, error) {
        return kc.cache().ReadAt(kc, locator, p, off)
 }
 
-// Ask() verifies that a block with the given hash is available and
+// Ask verifies that a block with the given hash is available and
 // readable, according to at least one Keep service. Unlike Get, it
 // does not retrieve the data or verify that the data content matches
 // the hash specified by the locator.
@@ -416,7 +416,7 @@ func (kc *KeepClient) GetIndex(keepServiceUUID, prefix string) (io.Reader, error
        return bytes.NewReader(respBody[0 : len(respBody)-1]), nil
 }
 
-// LocalRoots() returns the map of local (i.e., disk and proxy) Keep
+// LocalRoots returns the map of local (i.e., disk and proxy) Keep
 // services: uuid -> baseURI.
 func (kc *KeepClient) LocalRoots() map[string]string {
        kc.discoverServices()
@@ -425,7 +425,7 @@ func (kc *KeepClient) LocalRoots() map[string]string {
        return kc.localRoots
 }
 
-// GatewayRoots() returns the map of Keep remote gateway services:
+// GatewayRoots returns the map of Keep remote gateway services:
 // uuid -> baseURI.
 func (kc *KeepClient) GatewayRoots() map[string]string {
        kc.discoverServices()
@@ -434,7 +434,7 @@ func (kc *KeepClient) GatewayRoots() map[string]string {
        return kc.gatewayRoots
 }
 
-// WritableLocalRoots() returns the map of writable local Keep services:
+// WritableLocalRoots returns the map of writable local Keep services:
 // uuid -> baseURI.
 func (kc *KeepClient) WritableLocalRoots() map[string]string {
        kc.discoverServices()
index bd3bb0ba8ed5a3bb33f2cdd26524be70189e8c99..a6fbaeded37ad68ac78ae307c85c41647fdb5f1e 100644 (file)
@@ -19,14 +19,14 @@ func FakeSvcRoot(i uint64) string {
        return fmt.Sprintf("https://%x.svc/", i)
 }
 
-func FakeSvcUuid(i uint64) string {
+func FakeSvcUUID(i uint64) string {
        return fmt.Sprintf("zzzzz-bi6l4-%015x", i)
 }
 
 func FakeServiceRoots(n uint64) map[string]string {
        sr := map[string]string{}
        for i := uint64(0); i < n; i++ {
-               sr[FakeSvcUuid(i)] = FakeSvcRoot(i)
+               sr[FakeSvcUUID(i)] = FakeSvcRoot(i)
        }
        return sr
 }
@@ -45,19 +45,19 @@ func (*RootSorterSuite) ReferenceSet(c *C) {
        fakeroots := FakeServiceRoots(16)
        // These reference probe orders are explained further in
        // ../../python/tests/test_keep_client.py:
-       expected_orders := []string{
+       expectedOrders := []string{
                "3eab2d5fc9681074",
                "097dba52e648f1c3",
                "c5b4e023f8a7d691",
                "9d81c02e76a3bf54",
        }
-       for h, expected_order := range expected_orders {
+       for h, expectedOrder := range expectedOrders {
                hash := Md5String(fmt.Sprintf("%064x", h))
                roots := NewRootSorter(fakeroots, hash).GetSortedRoots()
-               for i, svc_id_s := range strings.Split(expected_order, "") {
-                       svc_id, err := strconv.ParseUint(svc_id_s, 16, 64)
+               for i, svcIDs := range strings.Split(expectedOrder, "") {
+                       svcID, err := strconv.ParseUint(svcIDs, 16, 64)
                        c.Assert(err, Equals, nil)
-                       c.Check(roots[i], Equals, FakeSvcRoot(svc_id))
+                       c.Check(roots[i], Equals, FakeSvcRoot(svcID))
                }
        }
 }