[ARVADOS] updated: 0ad0ce519da703b3f13c0ad8a74ea8235b7d90e5

git at public.curoverse.com git at public.curoverse.com
Sat Sep 12 11:09:12 EDT 2015


Summary of changes:
 services/keepstore/bufferpool_test.go |   4 +-
 services/keepstore/handler_test.go    | 328 +++++++++++++++++-----------------
 services/keepstore/handlers.go        | 128 ++++++-------
 services/keepstore/keepstore.go       |  34 ++--
 services/keepstore/keepstore_test.go  |  10 +-
 services/keepstore/volume.go          |   4 +-
 services/keepstore/volume_unix.go     |   6 +-
 7 files changed, 260 insertions(+), 254 deletions(-)

       via  0ad0ce519da703b3f13c0ad8a74ea8235b7d90e5 (commit)
       via  a5f4236f9dfc56e7374d108cc595c2aab57e3a0e (commit)
      from  12da8133a90777f2faca72ee2cbba11cc71480e8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 0ad0ce519da703b3f13c0ad8a74ea8235b7d90e5
Author: radhika <radhika at curoverse.com>
Date:   Sat Sep 12 11:02:22 2015 -0400

    7179: several golint suggested updates such as "don't use ALL_CAPS in Go names; use CamelCase".
    Now keepstore.go and handlers.go are almost lint free; a few such as blob_signature_ttl are not renamed at this time.

diff --git a/services/keepstore/bufferpool_test.go b/services/keepstore/bufferpool_test.go
index 95d118e..8726a19 100644
--- a/services/keepstore/bufferpool_test.go
+++ b/services/keepstore/bufferpool_test.go
@@ -18,12 +18,12 @@ type BufferPoolSuite struct{}
 // Initialize a default-sized buffer pool for the benefit of test
 // suites that don't run main().
 func init() {
-	bufs = newBufferPool(maxBuffers, BLOCKSIZE)
+	bufs = newBufferPool(maxBuffers, BlockSize)
 }
 
 // Restore sane default after bufferpool's own tests
 func (s *BufferPoolSuite) TearDownTest(c *C) {
-	bufs = newBufferPool(maxBuffers, BLOCKSIZE)
+	bufs = newBufferPool(maxBuffers, BlockSize)
 }
 
 func (s *BufferPoolSuite) TestBufferPoolBufSize(c *C) {
diff --git a/services/keepstore/handler_test.go b/services/keepstore/handler_test.go
index 68e80c4..8191466 100644
--- a/services/keepstore/handler_test.go
+++ b/services/keepstore/handler_test.go
@@ -52,7 +52,7 @@ func TestGetHandler(t *testing.T) {
 
 	// Create locators for testing.
 	// Turn on permission settings so we can generate signed locators.
-	enforce_permissions = true
+	enforcePermissions = true
 	PermissionSecret = []byte(known_key)
 	blob_signature_ttl = 300 * time.Second
 
@@ -66,7 +66,7 @@ func TestGetHandler(t *testing.T) {
 
 	// -----------------
 	// Test unauthenticated request with permissions off.
-	enforce_permissions = false
+	enforcePermissions = false
 
 	// Unauthenticated request, unsigned locator
 	// => OK
@@ -90,7 +90,7 @@ func TestGetHandler(t *testing.T) {
 
 	// ----------------
 	// Permissions: on.
-	enforce_permissions = true
+	enforcePermissions = true
 
 	// Authenticated request, signed locator
 	// => OK
@@ -274,7 +274,7 @@ func TestPutAndDeleteSkipReadonlyVolumes(t *testing.T) {
 //   - authenticated   /index/prefix request | superuser
 //
 // The only /index requests that should succeed are those issued by the
-// superuser. They should pass regardless of the value of enforce_permissions.
+// superuser. They should pass regardless of the value of enforcePermissions.
 //
 func TestIndexHandler(t *testing.T) {
 	defer teardown()
@@ -326,15 +326,15 @@ func TestIndexHandler(t *testing.T) {
 	// Only the superuser should be allowed to issue /index requests.
 
 	// ---------------------------
-	// enforce_permissions enabled
+	// enforcePermissions enabled
 	// This setting should not affect tests passing.
-	enforce_permissions = true
+	enforcePermissions = true
 
 	// unauthenticated /index request
 	// => UnauthorizedError
 	response := IssueRequest(unauthenticatedReq)
 	ExpectStatusCode(t,
-		"enforce_permissions on, unauthenticated request",
+		"enforcePermissions on, unauthenticated request",
 		UnauthorizedError.HTTPCode,
 		response)
 
@@ -371,9 +371,9 @@ func TestIndexHandler(t *testing.T) {
 		response)
 
 	// ----------------------------
-	// enforce_permissions disabled
+	// enforcePermissions disabled
 	// Valid Request should still pass.
-	enforce_permissions = false
+	enforcePermissions = false
 
 	// superuser /index request
 	// => OK
@@ -822,7 +822,7 @@ func TestPutNeedsOnlyOneBuffer(t *testing.T) {
 	defer func(orig *bufferPool) {
 		bufs = orig
 	}(bufs)
-	bufs = newBufferPool(1, BLOCKSIZE)
+	bufs = newBufferPool(1, BlockSize)
 
 	ok := make(chan struct{})
 	go func() {
diff --git a/services/keepstore/handlers.go b/services/keepstore/handlers.go
index 3dcc6e1..0974549 100644
--- a/services/keepstore/handlers.go
+++ b/services/keepstore/handlers.go
@@ -60,12 +60,14 @@ func MakeRESTRouter() *mux.Router {
 	return rest
 }
 
+// BadRequestHandler is a HandleFunc to address bad requests.
 func BadRequestHandler(w http.ResponseWriter, r *http.Request) {
 	http.Error(w, BadRequestError.Error(), BadRequestError.HTTPCode)
 }
 
+// GetBlockHandler is a HandleFunc to address Get block requests.
 func GetBlockHandler(resp http.ResponseWriter, req *http.Request) {
-	if enforce_permissions {
+	if enforcePermissions {
 		locator := req.URL.Path[1:] // strip leading slash
 		if err := VerifySignature(locator, GetApiToken(req)); err != nil {
 			http.Error(resp, err.Error(), err.(*KeepError).HTTPCode)
@@ -87,6 +89,7 @@ func GetBlockHandler(resp http.ResponseWriter, req *http.Request) {
 	resp.Write(block)
 }
 
+// PutBlockHandler is a HandleFunc to address Put block requests.
 func PutBlockHandler(resp http.ResponseWriter, req *http.Request) {
 	hash := mux.Vars(req)["hash"]
 
@@ -99,7 +102,7 @@ func PutBlockHandler(resp http.ResponseWriter, req *http.Request) {
 		return
 	}
 
-	if req.ContentLength > BLOCKSIZE {
+	if req.ContentLength > BlockSize {
 		http.Error(resp, TooLongError.Error(), TooLongError.HTTPCode)
 		return
 	}
@@ -128,18 +131,16 @@ func PutBlockHandler(resp http.ResponseWriter, req *http.Request) {
 
 	// Success; add a size hint, sign the locator if possible, and
 	// return it to the client.
-	return_hash := fmt.Sprintf("%s+%d", hash, req.ContentLength)
-	api_token := GetApiToken(req)
-	if PermissionSecret != nil && api_token != "" {
+	returnHash := fmt.Sprintf("%s+%d", hash, req.ContentLength)
+	apiToken := GetApiToken(req)
+	if PermissionSecret != nil && apiToken != "" {
 		expiry := time.Now().Add(blob_signature_ttl)
-		return_hash = SignLocator(return_hash, api_token, expiry)
+		returnHash = SignLocator(returnHash, apiToken, expiry)
 	}
-	resp.Write([]byte(return_hash + "\n"))
+	resp.Write([]byte(returnHash + "\n"))
 }
 
-// IndexHandler
-//     A HandleFunc to address /index and /index/{prefix} requests.
-//
+// IndexHandler is a HandleFunc to address /index and /index/{prefix} requests.
 func IndexHandler(resp http.ResponseWriter, req *http.Request) {
 	// Reject unauthorized requests.
 	if !IsDataManagerToken(GetApiToken(req)) {
@@ -178,12 +179,14 @@ func IndexHandler(resp http.ResponseWriter, req *http.Request) {
 //            * bytes_free
 //            * bytes_used
 
+// PoolStatus struct
 type PoolStatus struct {
 	Alloc uint64 `json:"BytesAllocated"`
 	Cap   int    `json:"BuffersMax"`
 	Len   int    `json:"BuffersInUse"`
 }
 
+// NodeStatus struct
 type NodeStatus struct {
 	Volumes    []*VolumeStatus `json:"volumes"`
 	BufferPool PoolStatus
@@ -195,6 +198,7 @@ type NodeStatus struct {
 var st NodeStatus
 var stLock sync.Mutex
 
+// StatusHandler addresses /status.json requests.
 func StatusHandler(resp http.ResponseWriter, req *http.Request) {
 	stLock.Lock()
 	readNodeStatus(&st)
@@ -353,11 +357,13 @@ func DeleteHandler(resp http.ResponseWriter, req *http.Request) {
    If the JSON unmarshalling fails, return 400 Bad Request.
 */
 
+// PullRequest consists of a block locator and an ordered list of servers
 type PullRequest struct {
 	Locator string   `json:"locator"`
 	Servers []string `json:"servers"`
 }
 
+// PullHandler processes "PUT /pull" requests for the data manager.
 func PullHandler(resp http.ResponseWriter, req *http.Request) {
 	// Reject unauthorized requests.
 	if !IsDataManagerToken(GetApiToken(req)) {
@@ -387,11 +393,13 @@ func PullHandler(resp http.ResponseWriter, req *http.Request) {
 	pullq.ReplaceQueue(plist)
 }
 
+// TrashRequest consists of a block locator and it's Mtime
 type TrashRequest struct {
 	Locator    string `json:"locator"`
 	BlockMtime int64  `json:"block_mtime"`
 }
 
+// TrashHandler processes /trash requests.
 func TrashHandler(resp http.ResponseWriter, req *http.Request) {
 	// Reject unauthorized requests.
 	if !IsDataManagerToken(GetApiToken(req)) {
@@ -432,8 +440,8 @@ func TrashHandler(resp http.ResponseWriter, req *http.Request) {
 // should be the only part of the code that cares about which volume a
 // block is stored on, so it should be responsible for figuring out
 // which volume to check for fetching blocks, storing blocks, etc.
-
 // ==============================
+
 // GetBlock fetches and returns the block identified by "hash".
 //
 // On success, GetBlock returns a byte slice with the block data, and
@@ -444,10 +452,9 @@ func TrashHandler(resp http.ResponseWriter, req *http.Request) {
 // If the block found does not have the correct MD5 hash, returns
 // DiskHashError.
 //
-
 func GetBlock(hash string) ([]byte, error) {
 	// Attempt to read the requested hash from a keep volume.
-	error_to_caller := NotFoundError
+	errorToCaller := NotFoundError
 
 	for _, vol := range KeepVM.AllReadable() {
 		buf, err := vol.Get(hash)
@@ -470,45 +477,46 @@ func GetBlock(hash string) ([]byte, error) {
 			// this.
 			log.Printf("%s: checksum mismatch for request %s (actual %s)",
 				vol, hash, filehash)
-			error_to_caller = DiskHashError
+			errorToCaller = DiskHashError
 			bufs.Put(buf)
 			continue
 		}
-		if error_to_caller == DiskHashError {
+		if errorToCaller == DiskHashError {
 			log.Printf("%s: checksum mismatch for request %s but a good copy was found on another volume and returned",
 				vol, hash)
 		}
 		return buf, nil
 	}
-	return nil, error_to_caller
+	return nil, errorToCaller
 }
 
-/* PutBlock(block, hash)
-   Stores the BLOCK (identified by the content id HASH) in Keep.
-
-   The MD5 checksum of the block must be identical to the content id HASH.
-   If not, an error is returned.
-
-   PutBlock stores the BLOCK on the first Keep volume with free space.
-   A failure code is returned to the user only if all volumes fail.
-
-   On success, PutBlock returns nil.
-   On failure, it returns a KeepError with one of the following codes:
-
-   500 Collision
-          A different block with the same hash already exists on this
-          Keep server.
-   422 MD5Fail
-          The MD5 hash of the BLOCK does not match the argument HASH.
-   503 Full
-          There was not enough space left in any Keep volume to store
-          the object.
-   500 Fail
-          The object could not be stored for some other reason (e.g.
-          all writes failed). The text of the error message should
-          provide as much detail as possible.
-*/
-
+// PutBlock Stores the BLOCK (identified by the content id HASH) in Keep.
+//
+// PutBlock(block, hash)
+//   Stores the BLOCK (identified by the content id HASH) in Keep.
+//
+//   The MD5 checksum of the block must be identical to the content id HASH.
+//   If not, an error is returned.
+//
+//   PutBlock stores the BLOCK on the first Keep volume with free space.
+//   A failure code is returned to the user only if all volumes fail.
+//
+//   On success, PutBlock returns nil.
+//   On failure, it returns a KeepError with one of the following codes:
+//
+//   500 Collision
+//          A different block with the same hash already exists on this
+//          Keep server.
+//   422 MD5Fail
+//          The MD5 hash of the BLOCK does not match the argument HASH.
+//   503 Full
+//          There was not enough space left in any Keep volume to store
+//          the object.
+//   500 Fail
+//          The object could not be stored for some other reason (e.g.
+//          all writes failed). The text of the error message should
+//          provide as much detail as possible.
+//
 func PutBlock(block []byte, hash string) error {
 	// Check that BLOCK's checksum matches HASH.
 	blockhash := fmt.Sprintf("%x", md5.Sum(block))
@@ -556,10 +564,9 @@ func PutBlock(block []byte, hash string) error {
 	if allFull {
 		log.Print("All volumes are full.")
 		return FullError
-	} else {
-		// Already logged the non-full errors.
-		return GenericError
 	}
+	// Already logged the non-full errors.
+	return GenericError
 }
 
 // CompareAndTouch returns nil if one of the volumes already has the
@@ -601,10 +608,9 @@ func CompareAndTouch(hash string, buf []byte) error {
 
 var validLocatorRe = regexp.MustCompile(`^[0-9a-f]{32}$`)
 
-// IsValidLocator
-//     Return true if the specified string is a valid Keep locator.
-//     When Keep is extended to support hash types other than MD5,
-//     this should be updated to cover those as well.
+// IsValidLocator returns true if the specified string is a valid Keep locator.
+//   When Keep is extended to support hash types other than MD5,
+//   this should be updated to cover those as well.
 //
 func IsValidLocator(loc string) bool {
 	return validLocatorRe.MatchString(loc)
@@ -612,7 +618,7 @@ func IsValidLocator(loc string) bool {
 
 var authRe = regexp.MustCompile(`^OAuth2\s+(.*)`)
 
-// GetApiToken returns the OAuth2 token from the Authorization
+// GetAPIToken returns the OAuth2 token from the Authorization
 // header of a HTTP request, or an empty string if no matching
 // token is found.
 func GetApiToken(req *http.Request) string {
@@ -625,10 +631,10 @@ func GetApiToken(req *http.Request) string {
 }
 
 // IsExpired returns true if the given Unix timestamp (expressed as a
-// hexadecimal string) is in the past, or if timestamp_hex cannot be
+// hexadecimal string) is in the past, or if timestampHex cannot be
 // parsed as a hexadecimal string.
-func IsExpired(timestamp_hex string) bool {
-	ts, err := strconv.ParseInt(timestamp_hex, 16, 0)
+func IsExpired(timestampHex string) bool {
+	ts, err := strconv.ParseInt(timestampHex, 16, 0)
 	if err != nil {
 		log.Printf("IsExpired: %s", err)
 		return true
@@ -636,25 +642,25 @@ func IsExpired(timestamp_hex string) bool {
 	return time.Unix(ts, 0).Before(time.Now())
 }
 
-// CanDelete returns true if the user identified by api_token is
+// CanDelete returns true if the user identified by apiToken is
 // allowed to delete blocks.
-func CanDelete(api_token string) bool {
-	if api_token == "" {
+func CanDelete(apiToken string) bool {
+	if apiToken == "" {
 		return false
 	}
 	// Blocks may be deleted only when Keep has been configured with a
 	// data manager.
-	if IsDataManagerToken(api_token) {
+	if IsDataManagerToken(apiToken) {
 		return true
 	}
-	// TODO(twp): look up api_token with the API server
+	// TODO(twp): look up apiToken with the API server
 	// return true if is_admin is true and if the token
 	// has unlimited scope
 	return false
 }
 
-// IsDataManagerToken returns true if api_token represents the data
+// IsDataManagerToken returns true if apiToken represents the data
 // manager's token.
-func IsDataManagerToken(api_token string) bool {
-	return data_manager_token != "" && api_token == data_manager_token
+func IsDataManagerToken(apiToken string) bool {
+	return data_manager_token != "" && apiToken == data_manager_token
 }
diff --git a/services/keepstore/keepstore.go b/services/keepstore/keepstore.go
index 53cf7be..9c84534 100644
--- a/services/keepstore/keepstore.go
+++ b/services/keepstore/keepstore.go
@@ -27,21 +27,22 @@ import (
 
 // Default TCP address on which to listen for requests.
 // Initialized by the --listen flag.
-const DEFAULT_ADDR = ":25107"
+const DefaultAddr = ":25107"
 
 // A Keep "block" is 64MB.
-const BLOCKSIZE = 64 * 1024 * 1024
+const BlockSize = 64 * 1024 * 1024
 
-// A Keep volume must have at least MIN_FREE_KILOBYTES available
+// A Keep volume must have at least MinFreeKilobytes available
 // in order to permit writes.
-const MIN_FREE_KILOBYTES = BLOCKSIZE / 1024
+const MinFreeKilobytes = BlockSize / 1024
 
-var PROC_MOUNTS = "/proc/mounts"
+// ProcMounts /proc/mounts
+var ProcMounts = "/proc/mounts"
 
-// enforce_permissions controls whether permission signatures
+// enforcePermissions controls whether permission signatures
 // should be enforced (affecting GET and DELETE requests).
 // Initialized by the -enforce-permissions flag.
-var enforce_permissions bool
+var enforcePermissions bool
 
 // blob_signature_ttl is the time duration for which new permission
 // signatures (returned by PUT requests) will be valid.
@@ -60,8 +61,7 @@ var never_delete = true
 var maxBuffers = 128
 var bufs *bufferPool
 
-// ==========
-// Error types.
+// KeepError types.
 //
 type KeepError struct {
 	HTTPCode int
@@ -161,15 +161,15 @@ func (vs *volumeSet) String() string {
 // other than "/". It returns the number of volumes added.
 func (vs *volumeSet) Discover() int {
 	added := 0
-	f, err := os.Open(PROC_MOUNTS)
+	f, err := os.Open(ProcMounts)
 	if err != nil {
-		log.Fatalf("opening %s: %s", PROC_MOUNTS, err)
+		log.Fatalf("opening %s: %s", ProcMounts, err)
 	}
 	scanner := bufio.NewScanner(f)
 	for scanner.Scan() {
 		args := strings.Fields(scanner.Text())
 		if err := scanner.Err(); err != nil {
-			log.Fatalf("reading %s: %s", PROC_MOUNTS, err)
+			log.Fatalf("reading %s: %s", ProcMounts, err)
 		}
 		dev, mount := args[0], args[1]
 		if mount == "/" {
@@ -225,14 +225,14 @@ func main() {
 		"File with the API token used by the Data Manager. All DELETE "+
 			"requests or GET /index requests must carry this token.")
 	flag.BoolVar(
-		&enforce_permissions,
+		&enforcePermissions,
 		"enforce-permissions",
 		false,
 		"Enforce permission signatures on requests.")
 	flag.StringVar(
 		&listen,
 		"listen",
-		DEFAULT_ADDR,
+		DefaultAddr,
 		"Listening address, in the form \"host:port\". e.g., 10.0.1.24:8000. Omit the host part to listen on all interfaces.")
 	flag.BoolVar(
 		&never_delete,
@@ -289,7 +289,7 @@ func main() {
 		&maxBuffers,
 		"max-buffers",
 		maxBuffers,
-		fmt.Sprintf("Maximum RAM to use for data buffers, given in multiples of block size (%d MiB). When this limit is reached, HTTP requests requiring buffers (like GET and PUT) will wait for buffer space to be released.", BLOCKSIZE>>20))
+		fmt.Sprintf("Maximum RAM to use for data buffers, given in multiples of block size (%d MiB). When this limit is reached, HTTP requests requiring buffers (like GET and PUT) will wait for buffer space to be released.", BlockSize>>20))
 
 	flag.Parse()
 
@@ -300,7 +300,7 @@ func main() {
 	if maxBuffers < 0 {
 		log.Fatal("-max-buffers must be greater than zero.")
 	}
-	bufs = newBufferPool(maxBuffers, BLOCKSIZE)
+	bufs = newBufferPool(maxBuffers, BlockSize)
 
 	if pidfile != "" {
 		f, err := os.OpenFile(pidfile, os.O_RDWR|os.O_CREATE, 0777)
@@ -358,7 +358,7 @@ func main() {
 	blob_signature_ttl = time.Duration(permission_ttl_sec) * time.Second
 
 	if PermissionSecret == nil {
-		if enforce_permissions {
+		if enforcePermissions {
 			log.Fatal("-enforce-permissions requires a permission key")
 		} else {
 			log.Println("Running without a PermissionSecret. Block locators " +
diff --git a/services/keepstore/keepstore_test.go b/services/keepstore/keepstore_test.go
index b89925f..eaf3560 100644
--- a/services/keepstore/keepstore_test.go
+++ b/services/keepstore/keepstore_test.go
@@ -309,7 +309,7 @@ func TestDiscoverTmpfs(t *testing.T) {
 		}
 	}
 
-	// Set up a bogus PROC_MOUNTS file.
+	// Set up a bogus ProcMounts file.
 	f, err := ioutil.TempFile("", "keeptest")
 	if err != nil {
 		t.Fatal(err)
@@ -327,7 +327,7 @@ func TestDiscoverTmpfs(t *testing.T) {
 		fmt.Fprintf(f, "tmpfs %s tmpfs %s 0 0\n", path.Dir(vol), opts)
 	}
 	f.Close()
-	PROC_MOUNTS = f.Name()
+	ProcMounts = f.Name()
 
 	var resultVols volumeSet
 	added := resultVols.Discover()
@@ -355,7 +355,7 @@ func TestDiscoverTmpfs(t *testing.T) {
 func TestDiscoverNone(t *testing.T) {
 	defer teardown()
 
-	// Set up a bogus PROC_MOUNTS file with no Keep vols.
+	// Set up a bogus ProcMounts file with no Keep vols.
 	f, err := ioutil.TempFile("", "keeptest")
 	if err != nil {
 		t.Fatal(err)
@@ -367,7 +367,7 @@ func TestDiscoverNone(t *testing.T) {
 	fmt.Fprintln(f, "udev /dev devtmpfs opts 0 0")
 	fmt.Fprintln(f, "devpts /dev/pts devpts opts 0 0")
 	f.Close()
-	PROC_MOUNTS = f.Name()
+	ProcMounts = f.Name()
 
 	var resultVols volumeSet
 	added := resultVols.Discover()
@@ -431,7 +431,7 @@ func MakeTestVolumeManager(num_volumes int) VolumeManager {
 // teardown cleans up after each test.
 func teardown() {
 	data_manager_token = ""
-	enforce_permissions = false
+	enforcePermissions = false
 	PermissionSecret = nil
 	KeepVM = nil
 }
diff --git a/services/keepstore/volume.go b/services/keepstore/volume.go
index cdaec92..e6a0f27 100644
--- a/services/keepstore/volume.go
+++ b/services/keepstore/volume.go
@@ -36,7 +36,7 @@ type Volume interface {
 	// access log if the block is not found on any other volumes
 	// either).
 	//
-	// If the data in the backing store is bigger than BLOCKSIZE,
+	// If the data in the backing store is bigger than BlockSize,
 	// Get is permitted to return an error without reading any of
 	// the data.
 	Get(loc string) ([]byte, error)
@@ -52,7 +52,7 @@ type Volume interface {
 	//
 	// loc is as described in Get.
 	//
-	// len(block) is guaranteed to be between 0 and BLOCKSIZE.
+	// len(block) is guaranteed to be between 0 and BlockSize.
 	//
 	// If a block is already stored under the same name (loc) with
 	// different content, Put must either overwrite the existing
diff --git a/services/keepstore/volume_unix.go b/services/keepstore/volume_unix.go
index 74bee52..12fcef8 100644
--- a/services/keepstore/volume_unix.go
+++ b/services/keepstore/volume_unix.go
@@ -79,7 +79,7 @@ func (v *UnixVolume) stat(path string) (os.FileInfo, error) {
 	if err == nil {
 		if stat.Size() < 0 {
 			err = os.ErrInvalid
-		} else if stat.Size() > BLOCKSIZE {
+		} else if stat.Size() > BlockSize {
 			err = TooLongError
 		}
 	}
@@ -343,7 +343,7 @@ func (v *UnixVolume) blockPath(loc string) string {
 }
 
 // IsFull returns true if the free space on the volume is less than
-// MIN_FREE_KILOBYTES.
+// MinFreeKilobytes.
 //
 func (v *UnixVolume) IsFull() (isFull bool) {
 	fullSymlink := v.root + "/full"
@@ -359,7 +359,7 @@ func (v *UnixVolume) IsFull() (isFull bool) {
 	}
 
 	if avail, err := v.FreeDiskSpace(); err == nil {
-		isFull = avail < MIN_FREE_KILOBYTES
+		isFull = avail < MinFreeKilobytes
 	} else {
 		log.Printf("%s: FreeDiskSpace: %s\n", v, err)
 		isFull = false

commit a5f4236f9dfc56e7374d108cc595c2aab57e3a0e
Author: radhika <radhika at curoverse.com>
Date:   Sat Sep 12 10:06:23 2015 -0400

    7179: handler_test.go is now lint free according to golint.

diff --git a/services/keepstore/handler_test.go b/services/keepstore/handler_test.go
index a9bf91e..68e80c4 100644
--- a/services/keepstore/handler_test.go
+++ b/services/keepstore/handler_test.go
@@ -25,10 +25,10 @@ import (
 // A RequestTester represents the parameters for an HTTP request to
 // be issued on behalf of a unit test.
 type RequestTester struct {
-	uri          string
-	api_token    string
-	method       string
-	request_body []byte
+	uri         string
+	apiToken    string
+	method      string
+	requestBody []byte
 }
 
 // Test GetBlockHandler on the following situations:
@@ -57,11 +57,11 @@ func TestGetHandler(t *testing.T) {
 	blob_signature_ttl = 300 * time.Second
 
 	var (
-		unsigned_locator  = "/" + TEST_HASH
-		valid_timestamp   = time.Now().Add(blob_signature_ttl)
-		expired_timestamp = time.Now().Add(-time.Hour)
-		signed_locator    = "/" + SignLocator(TEST_HASH, known_token, valid_timestamp)
-		expired_locator   = "/" + SignLocator(TEST_HASH, known_token, expired_timestamp)
+		unsignedLocator  = "/" + TEST_HASH
+		validTimestamp   = time.Now().Add(blob_signature_ttl)
+		expiredTimestamp = time.Now().Add(-time.Hour)
+		signedLocator    = "/" + SignLocator(TEST_HASH, known_token, validTimestamp)
+		expiredLocator   = "/" + SignLocator(TEST_HASH, known_token, expiredTimestamp)
 	)
 
 	// -----------------
@@ -73,7 +73,7 @@ func TestGetHandler(t *testing.T) {
 	response := IssueRequest(
 		&RequestTester{
 			method: "GET",
-			uri:    unsigned_locator,
+			uri:    unsignedLocator,
 		})
 	ExpectStatusCode(t,
 		"Unauthenticated request, unsigned locator", http.StatusOK, response)
@@ -82,10 +82,10 @@ func TestGetHandler(t *testing.T) {
 		string(TEST_BLOCK),
 		response)
 
-	received_cl := response.Header().Get("Content-Length")
-	expected_cl := fmt.Sprintf("%d", len(TEST_BLOCK))
-	if received_cl != expected_cl {
-		t.Errorf("expected Content-Length %s, got %s", expected_cl, received_cl)
+	receivedLen := response.Header().Get("Content-Length")
+	expectedLen := fmt.Sprintf("%d", len(TEST_BLOCK))
+	if receivedLen != expectedLen {
+		t.Errorf("expected Content-Length %s, got %s", expectedLen, receivedLen)
 	}
 
 	// ----------------
@@ -95,27 +95,27 @@ func TestGetHandler(t *testing.T) {
 	// Authenticated request, signed locator
 	// => OK
 	response = IssueRequest(&RequestTester{
-		method:    "GET",
-		uri:       signed_locator,
-		api_token: known_token,
+		method:   "GET",
+		uri:      signedLocator,
+		apiToken: known_token,
 	})
 	ExpectStatusCode(t,
 		"Authenticated request, signed locator", http.StatusOK, response)
 	ExpectBody(t,
 		"Authenticated request, signed locator", string(TEST_BLOCK), response)
 
-	received_cl = response.Header().Get("Content-Length")
-	expected_cl = fmt.Sprintf("%d", len(TEST_BLOCK))
-	if received_cl != expected_cl {
-		t.Errorf("expected Content-Length %s, got %s", expected_cl, received_cl)
+	receivedLen = response.Header().Get("Content-Length")
+	expectedLen = fmt.Sprintf("%d", len(TEST_BLOCK))
+	if receivedLen != expectedLen {
+		t.Errorf("expected Content-Length %s, got %s", expectedLen, receivedLen)
 	}
 
 	// Authenticated request, unsigned locator
 	// => PermissionError
 	response = IssueRequest(&RequestTester{
-		method:    "GET",
-		uri:       unsigned_locator,
-		api_token: known_token,
+		method:   "GET",
+		uri:      unsignedLocator,
+		apiToken: known_token,
 	})
 	ExpectStatusCode(t, "unsigned locator", PermissionError.HTTPCode, response)
 
@@ -123,7 +123,7 @@ func TestGetHandler(t *testing.T) {
 	// => PermissionError
 	response = IssueRequest(&RequestTester{
 		method: "GET",
-		uri:    signed_locator,
+		uri:    signedLocator,
 	})
 	ExpectStatusCode(t,
 		"Unauthenticated request, signed locator",
@@ -132,9 +132,9 @@ func TestGetHandler(t *testing.T) {
 	// Authenticated request, expired locator
 	// => ExpiredError
 	response = IssueRequest(&RequestTester{
-		method:    "GET",
-		uri:       expired_locator,
-		api_token: known_token,
+		method:   "GET",
+		uri:      expiredLocator,
+		apiToken: known_token,
 	})
 	ExpectStatusCode(t,
 		"Authenticated request, expired locator",
@@ -158,12 +158,12 @@ func TestPutHandler(t *testing.T) {
 
 	// Unauthenticated request, no server key
 	// => OK (unsigned response)
-	unsigned_locator := "/" + TEST_HASH
+	unsignedLocator := "/" + TEST_HASH
 	response := IssueRequest(
 		&RequestTester{
-			method:       "PUT",
-			uri:          unsigned_locator,
-			request_body: TEST_BLOCK,
+			method:      "PUT",
+			uri:         unsignedLocator,
+			requestBody: TEST_BLOCK,
 		})
 
 	ExpectStatusCode(t,
@@ -185,29 +185,29 @@ func TestPutHandler(t *testing.T) {
 	// => OK (signed response)
 	response = IssueRequest(
 		&RequestTester{
-			method:       "PUT",
-			uri:          unsigned_locator,
-			request_body: TEST_BLOCK,
-			api_token:    known_token,
+			method:      "PUT",
+			uri:         unsignedLocator,
+			requestBody: TEST_BLOCK,
+			apiToken:    known_token,
 		})
 
 	ExpectStatusCode(t,
 		"Authenticated PUT, signed locator, with server key",
 		http.StatusOK, response)
-	response_locator := strings.TrimSpace(response.Body.String())
-	if VerifySignature(response_locator, known_token) != nil {
+	responseLocator := strings.TrimSpace(response.Body.String())
+	if VerifySignature(responseLocator, known_token) != nil {
 		t.Errorf("Authenticated PUT, signed locator, with server key:\n"+
 			"response '%s' does not contain a valid signature",
-			response_locator)
+			responseLocator)
 	}
 
 	// Unauthenticated PUT, unsigned locator
 	// => OK
 	response = IssueRequest(
 		&RequestTester{
-			method:       "PUT",
-			uri:          unsigned_locator,
-			request_body: TEST_BLOCK,
+			method:      "PUT",
+			uri:         unsignedLocator,
+			requestBody: TEST_BLOCK,
 		})
 
 	ExpectStatusCode(t,
@@ -227,9 +227,9 @@ func TestPutAndDeleteSkipReadonlyVolumes(t *testing.T) {
 	defer KeepVM.Close()
 	IssueRequest(
 		&RequestTester{
-			method:       "PUT",
-			uri:          "/" + TEST_HASH,
-			request_body: TEST_BLOCK,
+			method:      "PUT",
+			uri:         "/" + TEST_HASH,
+			requestBody: TEST_BLOCK,
 		})
 	defer func(orig bool) {
 		never_delete = orig
@@ -237,10 +237,10 @@ func TestPutAndDeleteSkipReadonlyVolumes(t *testing.T) {
 	never_delete = false
 	IssueRequest(
 		&RequestTester{
-			method:       "DELETE",
-			uri:          "/" + TEST_HASH,
-			request_body: TEST_BLOCK,
-			api_token:    data_manager_token,
+			method:      "DELETE",
+			uri:         "/" + TEST_HASH,
+			requestBody: TEST_BLOCK,
+			apiToken:    data_manager_token,
 		})
 	type expect struct {
 		volnum    int
@@ -293,33 +293,33 @@ func TestIndexHandler(t *testing.T) {
 
 	data_manager_token = "DATA MANAGER TOKEN"
 
-	unauthenticated_req := &RequestTester{
+	unauthenticatedReq := &RequestTester{
 		method: "GET",
 		uri:    "/index",
 	}
-	authenticated_req := &RequestTester{
-		method:    "GET",
-		uri:       "/index",
-		api_token: known_token,
+	authenticatedReq := &RequestTester{
+		method:   "GET",
+		uri:      "/index",
+		apiToken: known_token,
 	}
-	superuser_req := &RequestTester{
-		method:    "GET",
-		uri:       "/index",
-		api_token: data_manager_token,
+	superuserReq := &RequestTester{
+		method:   "GET",
+		uri:      "/index",
+		apiToken: data_manager_token,
 	}
-	unauth_prefix_req := &RequestTester{
+	unauthPrefixReq := &RequestTester{
 		method: "GET",
 		uri:    "/index/" + TEST_HASH[0:3],
 	}
-	auth_prefix_req := &RequestTester{
-		method:    "GET",
-		uri:       "/index/" + TEST_HASH[0:3],
-		api_token: known_token,
+	authPrefixReq := &RequestTester{
+		method:   "GET",
+		uri:      "/index/" + TEST_HASH[0:3],
+		apiToken: known_token,
 	}
-	superuser_prefix_req := &RequestTester{
-		method:    "GET",
-		uri:       "/index/" + TEST_HASH[0:3],
-		api_token: data_manager_token,
+	superuserPrefixReq := &RequestTester{
+		method:   "GET",
+		uri:      "/index/" + TEST_HASH[0:3],
+		apiToken: data_manager_token,
 	}
 
 	// -------------------------------------------------------------
@@ -332,7 +332,7 @@ func TestIndexHandler(t *testing.T) {
 
 	// unauthenticated /index request
 	// => UnauthorizedError
-	response := IssueRequest(unauthenticated_req)
+	response := IssueRequest(unauthenticatedReq)
 	ExpectStatusCode(t,
 		"enforce_permissions on, unauthenticated request",
 		UnauthorizedError.HTTPCode,
@@ -340,7 +340,7 @@ func TestIndexHandler(t *testing.T) {
 
 	// unauthenticated /index/prefix request
 	// => UnauthorizedError
-	response = IssueRequest(unauth_prefix_req)
+	response = IssueRequest(unauthPrefixReq)
 	ExpectStatusCode(t,
 		"permissions on, unauthenticated /index/prefix request",
 		UnauthorizedError.HTTPCode,
@@ -348,7 +348,7 @@ func TestIndexHandler(t *testing.T) {
 
 	// authenticated /index request, non-superuser
 	// => UnauthorizedError
-	response = IssueRequest(authenticated_req)
+	response = IssueRequest(authenticatedReq)
 	ExpectStatusCode(t,
 		"permissions on, authenticated request, non-superuser",
 		UnauthorizedError.HTTPCode,
@@ -356,7 +356,7 @@ func TestIndexHandler(t *testing.T) {
 
 	// authenticated /index/prefix request, non-superuser
 	// => UnauthorizedError
-	response = IssueRequest(auth_prefix_req)
+	response = IssueRequest(authPrefixReq)
 	ExpectStatusCode(t,
 		"permissions on, authenticated /index/prefix request, non-superuser",
 		UnauthorizedError.HTTPCode,
@@ -364,7 +364,7 @@ func TestIndexHandler(t *testing.T) {
 
 	// superuser /index request
 	// => OK
-	response = IssueRequest(superuser_req)
+	response = IssueRequest(superuserReq)
 	ExpectStatusCode(t,
 		"permissions on, superuser request",
 		http.StatusOK,
@@ -377,7 +377,7 @@ func TestIndexHandler(t *testing.T) {
 
 	// superuser /index request
 	// => OK
-	response = IssueRequest(superuser_req)
+	response = IssueRequest(superuserReq)
 	ExpectStatusCode(t,
 		"permissions on, superuser request",
 		http.StatusOK,
@@ -394,7 +394,7 @@ func TestIndexHandler(t *testing.T) {
 
 	// superuser /index/prefix request
 	// => OK
-	response = IssueRequest(superuser_prefix_req)
+	response = IssueRequest(superuserPrefixReq)
 	ExpectStatusCode(t,
 		"permissions on, superuser request",
 		http.StatusOK,
@@ -452,44 +452,44 @@ func TestDeleteHandler(t *testing.T) {
 	// even though they have just been created.
 	blob_signature_ttl = time.Duration(0)
 
-	var user_token = "NOT DATA MANAGER TOKEN"
+	var userToken = "NOT DATA MANAGER TOKEN"
 	data_manager_token = "DATA MANAGER TOKEN"
 
 	never_delete = false
 
-	unauth_req := &RequestTester{
+	unauthReq := &RequestTester{
 		method: "DELETE",
 		uri:    "/" + TEST_HASH,
 	}
 
-	user_req := &RequestTester{
-		method:    "DELETE",
-		uri:       "/" + TEST_HASH,
-		api_token: user_token,
+	userReq := &RequestTester{
+		method:   "DELETE",
+		uri:      "/" + TEST_HASH,
+		apiToken: userToken,
 	}
 
-	superuser_existing_block_req := &RequestTester{
-		method:    "DELETE",
-		uri:       "/" + TEST_HASH,
-		api_token: data_manager_token,
+	superuserExistingBlockReq := &RequestTester{
+		method:   "DELETE",
+		uri:      "/" + TEST_HASH,
+		apiToken: data_manager_token,
 	}
 
-	superuser_nonexistent_block_req := &RequestTester{
-		method:    "DELETE",
-		uri:       "/" + TEST_HASH_2,
-		api_token: data_manager_token,
+	superuserNonexistentBlockReq := &RequestTester{
+		method:   "DELETE",
+		uri:      "/" + TEST_HASH_2,
+		apiToken: data_manager_token,
 	}
 
 	// Unauthenticated request returns PermissionError.
 	var response *httptest.ResponseRecorder
-	response = IssueRequest(unauth_req)
+	response = IssueRequest(unauthReq)
 	ExpectStatusCode(t,
 		"unauthenticated request",
 		PermissionError.HTTPCode,
 		response)
 
 	// Authenticated non-admin request returns PermissionError.
-	response = IssueRequest(user_req)
+	response = IssueRequest(userReq)
 	ExpectStatusCode(t,
 		"authenticated non-admin request",
 		PermissionError.HTTPCode,
@@ -500,9 +500,9 @@ func TestDeleteHandler(t *testing.T) {
 		Deleted int `json:"copies_deleted"`
 		Failed  int `json:"copies_failed"`
 	}
-	var response_dc, expected_dc deletecounter
+	var responseDc, expectedDc deletecounter
 
-	response = IssueRequest(superuser_nonexistent_block_req)
+	response = IssueRequest(superuserNonexistentBlockReq)
 	ExpectStatusCode(t,
 		"data manager request, nonexistent block",
 		http.StatusNotFound,
@@ -510,7 +510,7 @@ func TestDeleteHandler(t *testing.T) {
 
 	// Authenticated admin request for existing block while never_delete is set.
 	never_delete = true
-	response = IssueRequest(superuser_existing_block_req)
+	response = IssueRequest(superuserExistingBlockReq)
 	ExpectStatusCode(t,
 		"authenticated request, existing block, method disabled",
 		MethodDisabledError.HTTPCode,
@@ -518,23 +518,23 @@ func TestDeleteHandler(t *testing.T) {
 	never_delete = false
 
 	// Authenticated admin request for existing block.
-	response = IssueRequest(superuser_existing_block_req)
+	response = IssueRequest(superuserExistingBlockReq)
 	ExpectStatusCode(t,
 		"data manager request, existing block",
 		http.StatusOK,
 		response)
 	// Expect response {"copies_deleted":1,"copies_failed":0}
-	expected_dc = deletecounter{1, 0}
-	json.NewDecoder(response.Body).Decode(&response_dc)
-	if response_dc != expected_dc {
-		t.Errorf("superuser_existing_block_req\nexpected: %+v\nreceived: %+v",
-			expected_dc, response_dc)
+	expectedDc = deletecounter{1, 0}
+	json.NewDecoder(response.Body).Decode(&responseDc)
+	if responseDc != expectedDc {
+		t.Errorf("superuserExistingBlockReq\nexpected: %+v\nreceived: %+v",
+			expectedDc, responseDc)
 	}
 	// Confirm the block has been deleted
 	_, err := vols[0].Get(TEST_HASH)
-	var block_deleted = os.IsNotExist(err)
-	if !block_deleted {
-		t.Error("superuser_existing_block_req: block not deleted")
+	var blockDeleted = os.IsNotExist(err)
+	if !blockDeleted {
+		t.Error("superuserExistingBlockReq: block not deleted")
 	}
 
 	// A DELETE request on a block newer than blob_signature_ttl
@@ -542,17 +542,17 @@ func TestDeleteHandler(t *testing.T) {
 	vols[0].Put(TEST_HASH, TEST_BLOCK)
 	blob_signature_ttl = time.Hour
 
-	response = IssueRequest(superuser_existing_block_req)
+	response = IssueRequest(superuserExistingBlockReq)
 	ExpectStatusCode(t,
 		"data manager request, existing block",
 		http.StatusOK,
 		response)
 	// Expect response {"copies_deleted":1,"copies_failed":0}
-	expected_dc = deletecounter{1, 0}
-	json.NewDecoder(response.Body).Decode(&response_dc)
-	if response_dc != expected_dc {
-		t.Errorf("superuser_existing_block_req\nexpected: %+v\nreceived: %+v",
-			expected_dc, response_dc)
+	expectedDc = deletecounter{1, 0}
+	json.NewDecoder(response.Body).Decode(&responseDc)
+	if responseDc != expectedDc {
+		t.Errorf("superuserExistingBlockReq\nexpected: %+v\nreceived: %+v",
+			expectedDc, responseDc)
 	}
 	// Confirm the block has NOT been deleted.
 	_, err = vols[0].Get(TEST_HASH)
@@ -591,12 +591,12 @@ func TestDeleteHandler(t *testing.T) {
 func TestPullHandler(t *testing.T) {
 	defer teardown()
 
-	var user_token = "USER TOKEN"
+	var userToken = "USER TOKEN"
 	data_manager_token = "DATA MANAGER TOKEN"
 
 	pullq = NewWorkQueue()
 
-	good_json := []byte(`[
+	goodJSON := []byte(`[
 		{
 			"locator":"locator_with_two_servers",
 			"servers":[
@@ -614,36 +614,36 @@ func TestPullHandler(t *testing.T) {
 		}
 	]`)
 
-	bad_json := []byte(`{ "key":"I'm a little teapot" }`)
+	badJSON := []byte(`{ "key":"I'm a little teapot" }`)
 
 	type pullTest struct {
-		name          string
-		req           RequestTester
-		response_code int
-		response_body string
+		name         string
+		req          RequestTester
+		responseCode int
+		responseBody string
 	}
 	var testcases = []pullTest{
 		{
 			"Valid pull list from an ordinary user",
-			RequestTester{"/pull", user_token, "PUT", good_json},
+			RequestTester{"/pull", userToken, "PUT", goodJSON},
 			http.StatusUnauthorized,
 			"Unauthorized\n",
 		},
 		{
 			"Invalid pull request from an ordinary user",
-			RequestTester{"/pull", user_token, "PUT", bad_json},
+			RequestTester{"/pull", userToken, "PUT", badJSON},
 			http.StatusUnauthorized,
 			"Unauthorized\n",
 		},
 		{
 			"Valid pull request from the data manager",
-			RequestTester{"/pull", data_manager_token, "PUT", good_json},
+			RequestTester{"/pull", data_manager_token, "PUT", goodJSON},
 			http.StatusOK,
 			"Received 3 pull requests\n",
 		},
 		{
 			"Invalid pull request from the data manager",
-			RequestTester{"/pull", data_manager_token, "PUT", bad_json},
+			RequestTester{"/pull", data_manager_token, "PUT", badJSON},
 			http.StatusBadRequest,
 			"",
 		},
@@ -651,8 +651,8 @@ func TestPullHandler(t *testing.T) {
 
 	for _, tst := range testcases {
 		response := IssueRequest(&tst.req)
-		ExpectStatusCode(t, tst.name, tst.response_code, response)
-		ExpectBody(t, tst.name, tst.response_body, response)
+		ExpectStatusCode(t, tst.name, tst.responseCode, response)
+		ExpectBody(t, tst.name, tst.responseBody, response)
 	}
 
 	// The Keep pull manager should have received one good list with 3
@@ -697,12 +697,12 @@ func TestPullHandler(t *testing.T) {
 func TestTrashHandler(t *testing.T) {
 	defer teardown()
 
-	var user_token = "USER TOKEN"
+	var userToken = "USER TOKEN"
 	data_manager_token = "DATA MANAGER TOKEN"
 
 	trashq = NewWorkQueue()
 
-	good_json := []byte(`[
+	goodJSON := []byte(`[
 		{
 			"locator":"block1",
 			"block_mtime":1409082153
@@ -717,37 +717,37 @@ func TestTrashHandler(t *testing.T) {
 		}
 	]`)
 
-	bad_json := []byte(`I am not a valid JSON string`)
+	badJSON := []byte(`I am not a valid JSON string`)
 
 	type trashTest struct {
-		name          string
-		req           RequestTester
-		response_code int
-		response_body string
+		name         string
+		req          RequestTester
+		responseCode int
+		responseBody string
 	}
 
 	var testcases = []trashTest{
 		{
 			"Valid trash list from an ordinary user",
-			RequestTester{"/trash", user_token, "PUT", good_json},
+			RequestTester{"/trash", userToken, "PUT", goodJSON},
 			http.StatusUnauthorized,
 			"Unauthorized\n",
 		},
 		{
 			"Invalid trash list from an ordinary user",
-			RequestTester{"/trash", user_token, "PUT", bad_json},
+			RequestTester{"/trash", userToken, "PUT", badJSON},
 			http.StatusUnauthorized,
 			"Unauthorized\n",
 		},
 		{
 			"Valid trash list from the data manager",
-			RequestTester{"/trash", data_manager_token, "PUT", good_json},
+			RequestTester{"/trash", data_manager_token, "PUT", goodJSON},
 			http.StatusOK,
 			"Received 3 trash requests\n",
 		},
 		{
 			"Invalid trash list from the data manager",
-			RequestTester{"/trash", data_manager_token, "PUT", bad_json},
+			RequestTester{"/trash", data_manager_token, "PUT", badJSON},
 			http.StatusBadRequest,
 			"",
 		},
@@ -755,8 +755,8 @@ func TestTrashHandler(t *testing.T) {
 
 	for _, tst := range testcases {
 		response := IssueRequest(&tst.req)
-		ExpectStatusCode(t, tst.name, tst.response_code, response)
-		ExpectBody(t, tst.name, tst.response_body, response)
+		ExpectStatusCode(t, tst.name, tst.responseCode, response)
+		ExpectBody(t, tst.name, tst.responseBody, response)
 	}
 
 	// The trash collector should have received one good list with 3
@@ -779,10 +779,10 @@ func TestTrashHandler(t *testing.T) {
 // REST router.  It returns the HTTP response to the request.
 func IssueRequest(rt *RequestTester) *httptest.ResponseRecorder {
 	response := httptest.NewRecorder()
-	body := bytes.NewReader(rt.request_body)
+	body := bytes.NewReader(rt.requestBody)
 	req, _ := http.NewRequest(rt.method, rt.uri, body)
-	if rt.api_token != "" {
-		req.Header.Set("Authorization", "OAuth2 "+rt.api_token)
+	if rt.apiToken != "" {
+		req.Header.Set("Authorization", "OAuth2 "+rt.apiToken)
 	}
 	loggingRouter := MakeLoggingRESTRouter()
 	loggingRouter.ServeHTTP(response, req)
@@ -794,22 +794,22 @@ func IssueRequest(rt *RequestTester) *httptest.ResponseRecorder {
 func ExpectStatusCode(
 	t *testing.T,
 	testname string,
-	expected_status int,
+	expectedStatus int,
 	response *httptest.ResponseRecorder) {
-	if response.Code != expected_status {
+	if response.Code != expectedStatus {
 		t.Errorf("%s: expected status %d, got %+v",
-			testname, expected_status, response)
+			testname, expectedStatus, response)
 	}
 }
 
 func ExpectBody(
 	t *testing.T,
 	testname string,
-	expected_body string,
+	expectedBody string,
 	response *httptest.ResponseRecorder) {
-	if expected_body != "" && response.Body.String() != expected_body {
+	if expectedBody != "" && response.Body.String() != expectedBody {
 		t.Errorf("%s: expected response body '%s', got %+v",
-			testname, expected_body, response)
+			testname, expectedBody, response)
 	}
 }
 
@@ -829,9 +829,9 @@ func TestPutNeedsOnlyOneBuffer(t *testing.T) {
 		for i := 0; i < 2; i++ {
 			response := IssueRequest(
 				&RequestTester{
-					method:       "PUT",
-					uri:          "/" + TEST_HASH,
-					request_body: TEST_BLOCK,
+					method:      "PUT",
+					uri:         "/" + TEST_HASH,
+					requestBody: TEST_BLOCK,
 				})
 			ExpectStatusCode(t,
 				"TestPutNeedsOnlyOneBuffer", http.StatusOK, response)
@@ -857,15 +857,15 @@ func TestPutHandlerNoBufferleak(t *testing.T) {
 
 	ok := make(chan bool)
 	go func() {
-		for i := 0; i < maxBuffers+1; i += 1 {
+		for i := 0; i < maxBuffers+1; i++ {
 			// Unauthenticated request, no server key
 			// => OK (unsigned response)
-			unsigned_locator := "/" + TEST_HASH
+			unsignedLocator := "/" + TEST_HASH
 			response := IssueRequest(
 				&RequestTester{
-					method:       "PUT",
-					uri:          unsigned_locator,
-					request_body: TEST_BLOCK,
+					method:      "PUT",
+					uri:         unsignedLocator,
+					requestBody: TEST_BLOCK,
 				})
 			ExpectStatusCode(t,
 				"TestPutHandlerBufferleak", http.StatusOK, response)
@@ -899,14 +899,14 @@ func TestGetHandlerNoBufferleak(t *testing.T) {
 
 	ok := make(chan bool)
 	go func() {
-		for i := 0; i < maxBuffers+1; i += 1 {
+		for i := 0; i < maxBuffers+1; i++ {
 			// Unauthenticated request, unsigned locator
 			// => OK
-			unsigned_locator := "/" + TEST_HASH
+			unsignedLocator := "/" + TEST_HASH
 			response := IssueRequest(
 				&RequestTester{
 					method: "GET",
-					uri:    unsigned_locator,
+					uri:    unsignedLocator,
 				})
 			ExpectStatusCode(t,
 				"Unauthenticated request, unsigned locator", http.StatusOK, response)

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list