From 74433ed9d011bc985dbd839f8ebc2a7ca0e6dc3a Mon Sep 17 00:00:00 2001 From: Martin Martinez Rivera Date: Thu, 18 Jul 2019 10:18:40 -0700 Subject: [PATCH] Fix gofmt and ineffassign warnings. (#933) --- db.go | 2 +- db_test.go | 3 +++ trie/trie_test.go | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/db.go b/db.go index 0ef762d2e..875598628 100644 --- a/db.go +++ b/db.go @@ -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 diff --git a/db_test.go b/db_test.go index 874960521..17194cd84 100644 --- a/db_test.go +++ b/db_test.go @@ -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. diff --git a/trie/trie_test.go b/trie/trie_test.go index dc97a26f8..31b4854a0 100644 --- a/trie/trie_test.go +++ b/trie/trie_test.go @@ -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) { @@ -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"))) }