Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup from go-staticcheck #104

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ func (c *Collection) free(idx uint32) {
c.fill.Remove(idx)
atomic.StoreUint64(&c.count, uint64(c.fill.Count()))
c.lock.Unlock()
return
}

// findFreeIndex finds a free index for insertion
Expand Down
2 changes: 1 addition & 1 deletion column_expire.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (s rwTTL) Extend(delta time.Duration) {

// readTTL converts expiration to a TTL
func readTTL(expireAt int64) time.Duration {
return time.Unix(0, expireAt).Sub(time.Now())
return time.Until(time.Unix(0, expireAt))
}

// writeTTL converts ttl to expireAt
Expand Down
3 changes: 1 addition & 2 deletions column_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ func newSortIndex(indexName, columnName string) *column {

// Grow grows the size of the column until we have enough to store
func (c *columnSortIndex) Grow(idx uint32) {
return
}

// Column returns the target name of the column on which this index should apply.
Expand Down Expand Up @@ -222,7 +221,7 @@ func (c *columnSortIndex) Apply(chunk commit.Chunk, r *commit.Reader) {
Value: r.Index(),
})
case commit.Delete:
delKey, _ := c.backMap[r.Index()]
delKey := c.backMap[r.Index()]
c.btree.Delete(sortIndexItem{
Key: delKey,
Value: r.Index(),
Expand Down
1 change: 1 addition & 0 deletions commit/buffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ func TestBufferWriteTo(t *testing.T) {

output := NewBuffer(0)
m, err := output.ReadFrom(buffer)
assert.NoError(t, err)
assert.Equal(t, int64(buffer.Len()), m)
assert.Equal(t, input, output)
}
Expand Down
11 changes: 0 additions & 11 deletions commit/commit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,6 @@ func newInterleaved(columnName string) *Buffer {
return buf
}

// updatesAt reads a set of int64 updates from a buffer at a given chunk
func updatesAt(buffer *Buffer, chunk Chunk) (updates []int64) {
reader := NewReader()
reader.Range(buffer, chunk, func(r *Reader) {
for r.Next() {
updates = append(updates, r.Int64())
}
})
return
}

// --------------------------- Mocks ----------------------------

type limitWriter struct {
Expand Down
4 changes: 1 addition & 3 deletions txn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,7 @@ func TestSortIndex(t *testing.T) {

// Range
assert.Error(t, c.Query(func(txn *Txn) error {
return txn.Ascend("nonexistent", func(i uint32) {
return
})
return txn.Ascend("nonexistent", func(i uint32) {})
}))

var res [3]string
Expand Down