Make linter happy (#6693)

This commit is contained in:
Vishal Nayak 2019-05-07 17:13:42 -04:00 committed by GitHub
parent 550f2a52bd
commit a2cfc14a18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 3 deletions

View File

@ -16,7 +16,9 @@ import (
)
const (
bucketCount = 256
bucketCount = 256
// StoragePackerBucketsPrefix is the default storage key prefix under which
// bucket data will be stored.
StoragePackerBucketsPrefix = "packer/buckets/"
)
@ -35,7 +37,7 @@ func (s *StoragePacker) View() logical.Storage {
return s.view
}
// Get returns a bucket for a given key
// GetBucket returns a bucket for a given key
func (s *StoragePacker) GetBucket(key string) (*Bucket, error) {
if key == "" {
return nil, fmt.Errorf("missing bucket key")
@ -110,7 +112,12 @@ func (s *Bucket) upsert(item *Item) error {
// stored.
func (s *StoragePacker) BucketKey(itemID string) string {
hf := md5.New()
hf.Write([]byte(itemID))
input := []byte(itemID)
n, err := hf.Write(input)
// Make linter happy
if err != nil || n != len(input) {
return ""
}
index := uint8(hf.Sum(nil)[0])
return s.viewPrefix + strconv.Itoa(int(index))
}