7179: A few golint suggested updates. There are still a lot of golint complaints.
authorradhika <radhika@curoverse.com>
Sat, 12 Sep 2015 00:33:50 +0000 (20:33 -0400)
committerradhika <radhika@curoverse.com>
Sat, 12 Sep 2015 00:33:50 +0000 (20:33 -0400)
services/keepstore/volume.go
services/keepstore/volume_generic_test.go
services/keepstore/volume_unix_test.go
services/keepstore/work_queue.go

index daf003e1956a6dd1d951a8b17394ae7ec792ee71..cdaec9232685dffe50b485bdcbdac22ce0486c74 100644 (file)
@@ -1,7 +1,3 @@
-// A Volume is an interface representing a Keep back-end storage unit:
-// for example, a single mounted disk, a RAID array, an Amazon S3 volume,
-// etc.
-
 package main
 
 import (
@@ -10,6 +6,9 @@ import (
        "time"
 )
 
+// A Volume is an interface representing a Keep back-end storage unit:
+// for example, a single mounted disk, a RAID array, an Amazon S3 volume,
+// etc.
 type Volume interface {
        // Get a block. IFF the returned error is nil, the caller must
        // put the returned slice back into the buffer pool when it's
@@ -228,6 +227,7 @@ type RRVolumeManager struct {
        counter   uint32
 }
 
+// MakeRRVolumeManager initializes RRVolumeManager
 func MakeRRVolumeManager(volumes []Volume) *RRVolumeManager {
        vm := &RRVolumeManager{}
        for _, v := range volumes {
@@ -239,14 +239,17 @@ func MakeRRVolumeManager(volumes []Volume) *RRVolumeManager {
        return vm
 }
 
+// AllReadable returns an array of all readable volumes
 func (vm *RRVolumeManager) AllReadable() []Volume {
        return vm.readables
 }
 
+// AllWritable returns an array of all writable volumes
 func (vm *RRVolumeManager) AllWritable() []Volume {
        return vm.writables
 }
 
+// NextWritable returns the next writable
 func (vm *RRVolumeManager) NextWritable() Volume {
        if len(vm.writables) == 0 {
                return nil
@@ -255,10 +258,11 @@ func (vm *RRVolumeManager) NextWritable() Volume {
        return vm.writables[i%uint32(len(vm.writables))]
 }
 
+// Close the RRVolumeManager
 func (vm *RRVolumeManager) Close() {
 }
 
-// VolumeStatus
+// VolumeStatus provides status information of the volume consisting of:
 //   * mount_point
 //   * device_num (an integer identifying the underlying storage system)
 //   * bytes_free
index 9e2e6c639a1f8c851b32fbf19c70f17520c706b3..3c4b0517adeac7eab66053dcaccc034403a91cef 100644 (file)
@@ -299,18 +299,18 @@ func testIndexTo(t *testing.T, factory TestableVolumeFactory) {
 
        buf := new(bytes.Buffer)
        v.IndexTo("", buf)
-       index_rows := strings.Split(string(buf.Bytes()), "\n")
-       sort.Strings(index_rows)
-       sorted_index := strings.Join(index_rows, "\n")
+       indexRows := strings.Split(string(buf.Bytes()), "\n")
+       sort.Strings(indexRows)
+       sortedIndex := strings.Join(indexRows, "\n")
        m, err := regexp.MatchString(
                `^\n`+TEST_HASH+`\+\d+ \d+\n`+
                        TEST_HASH_3+`\+\d+ \d+\n`+
                        TEST_HASH_2+`\+\d+ \d+$`,
-               sorted_index)
+               sortedIndex)
        if err != nil {
                t.Error(err)
        } else if !m {
-               t.Errorf("Got index %q for empty prefix", sorted_index)
+               t.Errorf("Got index %q for empty prefix", sortedIndex)
        }
 
        for _, prefix := range []string{"f", "f15", "f15ac"} {
index f23a9c9c8ee450981c373c167823733ea15306fc..011471c7add67e95457a374df30cfdb679a7716d 100644 (file)
@@ -163,17 +163,17 @@ func TestIsFull(t *testing.T) {
        v := NewTestableUnixVolume(t, false, false)
        defer v.Teardown()
 
-       full_path := v.root + "/full"
+       fullPath := v.root + "/full"
        now := fmt.Sprintf("%d", time.Now().Unix())
-       os.Symlink(now, full_path)
+       os.Symlink(now, fullPath)
        if !v.IsFull() {
                t.Errorf("%s: claims not to be full", v)
        }
-       os.Remove(full_path)
+       os.Remove(fullPath)
 
        // Test with an expired /full link.
        expired := fmt.Sprintf("%d", time.Now().Unix()-3605)
-       os.Symlink(expired, full_path)
+       os.Symlink(expired, fullPath)
        if v.IsFull() {
                t.Errorf("%s: should no longer be full", v)
        }
index f1878ffbbc550250ab88c5ea9a4a694d12d63132..27646ad3d8d98c9b58e8693c079e3b40a14d1e1e 100644 (file)
@@ -84,6 +84,7 @@ package main
 
 import "container/list"
 
+// WorkQueue definition
 type WorkQueue struct {
        getStatus chan WorkQueueStatus
        newlist   chan *list.List
@@ -96,6 +97,7 @@ type WorkQueue struct {
        DoneItem chan<- struct{}
 }
 
+// WorkQueueStatus reflects the queue status.
 type WorkQueueStatus struct {
        InProgress int
        Queued     int