Skip to content
Merged
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
8 changes: 0 additions & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ linters:
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
- exhaustive # checks exhaustiveness of enum switch statements
- exportloopref # checks for pointers to enclosing loop variables
- forbidigo # forbids identifiers
- funlen # tool for detection of long functions
- gocheckcompilerdirectives # validates go compiler directive comments (//go:)
Expand Down Expand Up @@ -79,7 +78,6 @@ linters:
- sloglint # ensure consistent code style when using log/slog
- sqlclosecheck # checks that sql.Rows and sql.Stmt are closed
- stylecheck # is a replacement for golint
- tenv # detects using os.Setenv instead of t.Setenv since Go1.17
- testableexamples # checks if examples are testable (have an expected output)
- testifylint # checks usage of github.com/stretchr/testify
- testpackage # makes you use a separate _test package
Expand Down Expand Up @@ -239,12 +237,6 @@ linters-settings:
packages:
- github.com/jmoiron/sqlx

tenv:
# The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
# Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
# Default: false
all: true

issues:
# Maximum count of issues with the same text.
# Set to 0 to disable.
Expand Down
1 change: 1 addition & 0 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ func (c *Client[T]) performContinuousEvictions() {
func (c *Client[T]) getShard(key string) *shard[T] {
hash := xxhash.Sum64String(key)
shardIndex := hash % uint64(len(c.shards))
//nolint:gosec // we'll ignore potential integer overflows here.
c.reportShardIndex(int(shardIndex))
return c.shards[shardIndex]
}
Expand Down
4 changes: 2 additions & 2 deletions fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func getFetch[V, T any](ctx context.Context, c *Client[T], key string, fetchFn F
// then decide whether to proceed with the cached data or to
// propagate the error.
if err != nil && ok {
return value, ErrOnlyCachedRecords
return value, errors.Join(ErrOnlyCachedRecords, err)
}

return res, err
Expand Down Expand Up @@ -176,7 +176,7 @@ func getFetchBatch[V, T any](ctx context.Context, c *Client[T], ids []string, ke

if err != nil && !errors.Is(err, ErrOnlyCachedRecords) {
if len(cachedRecords) > 0 {
return cachedRecords, ErrOnlyCachedRecords
return cachedRecords, errors.Join(ErrOnlyCachedRecords, err)
}
return cachedRecords, err
}
Expand Down