Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
hadv committed May 19, 2023
1 parent 15bc2ad commit b8e7aba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion utils/circularbuff/circularbuff.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (c *Cache) Add(key, value interface{}) (evicted bool) {
// Check for existing item
evicted = false
if c.buf[c.next] == key {
v, _ := c.items[key]
v := c.items[key]
if c.onEvict != nil {
c.onEvict(key, v)
evicted = true
Expand Down
4 changes: 3 additions & 1 deletion utils/circularbuff/circularbuff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

func TestCircularCache(t *testing.T) {
t.Parallel()
cache, err := New(-1)
require.Nil(t, cache)
require.Error(t, err)
Expand All @@ -20,7 +21,7 @@ func TestCircularCache(t *testing.T) {
require.False(t, evicted)
}

// adding same key on the same position but no evict becuase the evict is nil
// adding same key on the same position but no evict because the evict is nil
require.True(t, cache.Contains(1))
val, _ := cache.Get(1)
require.Equal(t, 1, val)
Expand Down Expand Up @@ -59,6 +60,7 @@ func TestCircularCache(t *testing.T) {
}

func TestCircularCacheWithCallback(t *testing.T) {
t.Parallel()
size := 10
cache, err := NewWithEvict(size, func(key interface{}, value interface{}) {
require.Equal(t, key, 1)
Expand Down

0 comments on commit b8e7aba

Please sign in to comment.