Add constants for commonly used values. (#3588)

This is a consolidation effort, avoiding usage
of naked strings in codebase. Whenever possible
use constants which can be repurposed elsewhere.

This also fixes `goconst ./...` reported issues.
This commit is contained in:
Harshavardhana
2017-01-18 12:24:34 -08:00
committed by GitHub
parent f803bb4b3d
commit 62f8343879
79 changed files with 461 additions and 462 deletions

View File

@@ -40,11 +40,11 @@ func newHashWriters(diskCount int, algo string) []hash.Hash {
// newHash - gives you a newly allocated hash depending on the input algorithm.
func newHash(algo string) (h hash.Hash) {
switch algo {
case "sha256":
case sha256Algo:
// sha256 checksum specially on ARM64 platforms or whenever
// requested as dictated by `xl.json` entry.
h = sha256.New()
case "blake2b":
case blake2bAlgo:
// ignore the error, because New512 without a key never fails
// New512 only returns a non-nil error, if the length of the passed
// key > 64 bytes - but we use blake2b as hash function (no key)