lint fixes (#14)

* lint fixes

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-08-21 14:53:21 +03:00
committed by GitHub
parent 199ff66bd4
commit c4a303190a
42 changed files with 95 additions and 178 deletions

View File

@@ -221,7 +221,7 @@ func (s *sqlStore) List(opts ...store.ListOption) ([]string, error) {
pattern = options.Prefix + pattern
}
if options.Suffix != "" {
pattern = pattern + options.Suffix
pattern += options.Suffix
}
}
if options.Offset > 0 {
@@ -245,11 +245,11 @@ func (s *sqlStore) List(opts ...store.ListOption) ([]string, error) {
return nil, err
}
defer rows.Close()
var keys []string
records, err := s.rowsToRecords(rows)
if err != nil {
return nil, err
}
keys := make([]string, 0, len(records))
for _, k := range records {
keys = append(keys, k.Key)
}
@@ -360,7 +360,7 @@ func (s *sqlStore) read(key string, options store.ReadOptions) ([]*store.Record,
pattern = key + pattern
}
if options.Suffix {
pattern = pattern + key
pattern += key
}
var rows *sql.Rows

View File

@@ -102,10 +102,10 @@ func TestSQL(t *testing.T) {
switch err {
case nil:
t.Error("Key test should have expired")
default:
t.Error(err)
case store.ErrNotFound:
break
default:
t.Error(err)
}
sqlStore.Delete("bar")
sqlStore.Write(&store.Record{Key: "aaa", Value: []byte("bbb"), Expiry: 10 * time.Second})