Skip to content

Commit

Permalink
Fix gofmt and ineffassign warnings. (hypermodeinc#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmr authored Jul 18, 2019
1 parent c5bf7e3 commit 74433ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion db.go
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ func (db *DB) dropAll() (func(), error) {

// DropPrefix would drop all the keys with the provided prefix. It does this in the following way:
// - Stop accepting new writes.
// - Stop memtable flushes before aquiring lock. Because we're acquring lock here
// - Stop memtable flushes before acquiring lock. Because we're acquring lock here
// and memtable flush stalls for lock, which leads to deadlock
// - Flush out all memtables, skipping over keys with the given prefix, Kp.
// - Write out the value log header to memtables when flushing, so we don't accidentally bring Kp
Expand Down
3 changes: 3 additions & 0 deletions db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1855,6 +1855,9 @@ func ExampleDB_Subscribe() {
}
defer os.RemoveAll(dir)
db, err := Open(DefaultOptions(dir))
if err != nil {
log.Fatal(err)
}
defer db.Close()

// Create the context here so we can cancel it after sending the writes.
Expand Down
8 changes: 4 additions & 4 deletions trie/trie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ func TestGet(t *testing.T) {
ids := trie.Get([]byte("hel"))
require.Equal(t, 1, len(ids))

require.Equal(t, map[uint64]struct{}{20: struct{}{}}, ids)
require.Equal(t, map[uint64]struct{}{20: {}}, ids)
ids = trie.Get([]byte("badger"))
require.Equal(t, 1, len(ids))
require.Equal(t, map[uint64]struct{}{30: struct{}{}}, ids)
require.Equal(t, map[uint64]struct{}{30: {}}, ids)
ids = trie.Get([]byte("hello"))
require.Equal(t, 4, len(ids))
require.Equal(t, map[uint64]struct{}{1: struct{}{}, 3: struct{}{}, 4: struct{}{}, 20: struct{}{}}, ids)
require.Equal(t, map[uint64]struct{}{1: {}, 3: {}, 4: {}, 20: {}}, ids)
}

func TestTrieDelete(t *testing.T) {
Expand All @@ -48,5 +48,5 @@ func TestTrieDelete(t *testing.T) {
trie.Add([]byte("hello"), 3)
trie.Add([]byte("hello"), 4)
trie.Delete([]byte("hello"), 4)
require.Equal(t, map[uint64]struct{}{1: struct{}{}, 3: struct{}{}}, trie.Get([]byte("hello")))
require.Equal(t, map[uint64]struct{}{1: {}, 3: {}}, trie.Get([]byte("hello")))
}

0 comments on commit 74433ed

Please sign in to comment.