align more with go idioms

This commit is contained in:
Todd Gruben 2016-02-24 15:02:24 -06:00
parent a72edfdae8
commit 1aca83a546
2 changed files with 12 additions and 12 deletions

View file

@ -326,7 +326,7 @@ func (f *Fragment) SetBit(bitmapID, profileID uint64, t *time.Time, q TimeQuantu
func (f *Fragment) setBit(bitmapID, profileID uint64) (changed bool, bool error) {
// Determine the position of the bit in the storage.
ret := false
changed = false
pos, err := f.pos(bitmapID, profileID)
if err != nil {
return false, err
@ -334,15 +334,15 @@ func (f *Fragment) setBit(bitmapID, profileID uint64) (changed bool, bool error)
// Write to storage.
if ret, err = f.storage.Add(pos); err != nil {
if changed, err = f.storage.Add(pos); err != nil {
return false, err
}
// Update the cache.
if f.bitmap(bitmapID).setBit(profileID) {
ret = true
changed = true
}
return ret, nil
return changed, nil
}

View file

@ -41,8 +41,8 @@ func NewBitmap(a ...uint64) *Bitmap {
}
// Add adds values to the bitmap.
func (b *Bitmap) Add(a ...uint64) (bool, error) {
ret := false
func (b *Bitmap) Add(a ...uint64) (changed bool, err error) {
changed = false
for _, v := range a {
// Create an add operation.
op := &op{typ: opTypeAdd, value: v}
@ -54,12 +54,12 @@ func (b *Bitmap) Add(a ...uint64) (bool, error) {
// Apply to the in-memory bitmap.
if op.apply(b) {
ret = true
changed = true
}
}
return ret, nil
return changed, nil
}
func (b *Bitmap) add(v uint64) bool {
@ -86,8 +86,8 @@ func (b *Bitmap) Contains(v uint64) bool {
}
// Remove removes values from the bitmap.
func (b *Bitmap) Remove(a ...uint64) (bool, error) {
ret := false
func (b *Bitmap) Remove(a ...uint64) (changed bool, err error) {
changed = false
for _, v := range a {
// Create an add operation.
op := &op{typ: opTypeRemove, value: v}
@ -99,10 +99,10 @@ func (b *Bitmap) Remove(a ...uint64) (bool, error) {
// Apply operation to the bitmap.
if op.apply(b) {
ret = true
changed = true
}
}
return ret, nil
return changed, nil
}
func (b *Bitmap) remove(v uint64) bool {