aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/state
diff options
context:
space:
mode:
Diffstat (limited to 'swarm/state')
-rw-r--r--swarm/state/dbstore.go2
-rw-r--r--swarm/state/dbstore_test.go3
-rw-r--r--swarm/state/inmemorystore.go2
3 files changed, 5 insertions, 2 deletions
diff --git a/swarm/state/dbstore.go b/swarm/state/dbstore.go
index 5e5c172b2..b0aa92e27 100644
--- a/swarm/state/dbstore.go
+++ b/swarm/state/dbstore.go
@@ -69,7 +69,7 @@ func (s *DBStore) Get(key string, i interface{}) (err error) {
// Put stores an object that implements Binary for a specific key.
func (s *DBStore) Put(key string, i interface{}) (err error) {
- bytes := []byte{}
+ var bytes []byte
marshaler, ok := i.(encoding.BinaryMarshaler)
if !ok {
diff --git a/swarm/state/dbstore_test.go b/swarm/state/dbstore_test.go
index 6683e788f..f7098956d 100644
--- a/swarm/state/dbstore_test.go
+++ b/swarm/state/dbstore_test.go
@@ -112,6 +112,9 @@ func testPersistedStore(t *testing.T, store Store) {
as := []string{}
err = store.Get("key2", &as)
+ if err != nil {
+ t.Fatal(err)
+ }
if len(as) != 3 {
t.Fatalf("serialized array did not match expectation")
diff --git a/swarm/state/inmemorystore.go b/swarm/state/inmemorystore.go
index 1ca25404a..3ba48592b 100644
--- a/swarm/state/inmemorystore.go
+++ b/swarm/state/inmemorystore.go
@@ -59,7 +59,7 @@ func (s *InmemoryStore) Get(key string, i interface{}) (err error) {
func (s *InmemoryStore) Put(key string, i interface{}) (err error) {
s.mu.Lock()
defer s.mu.Unlock()
- bytes := []byte{}
+ var bytes []byte
marshaler, ok := i.(encoding.BinaryMarshaler)
if !ok {