Update golangci-lint to v2.12.2 with canonical config #54
@@ -291,7 +291,7 @@ func (c *Cache) StoreSource(
|
||||
// accounting insert is best-effort (the startup reconciliation pass
|
||||
// adopts any variant file that misses its accounting row).
|
||||
func (c *Cache) StoreVariant(
|
||||
cacheKey VariantKey, content io.Reader, contentType string,
|
||||
ctx context.Context, cacheKey VariantKey, content io.Reader, contentType string,
|
||||
) error {
|
||||
if c.disabled {
|
||||
return nil
|
||||
@@ -302,7 +302,7 @@ func (c *Cache) StoreVariant(
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = c.db.Exec(`
|
||||
_, err = c.db.ExecContext(ctx, `
|
||||
INSERT INTO variant_content (cache_key, size_bytes, content_type)
|
||||
VALUES (?, ?, ?)
|
||||
ON CONFLICT(cache_key) DO UPDATE SET
|
||||
|
||||
@@ -177,7 +177,8 @@ func TestCache_StoreAndLookup(t *testing.T) {
|
||||
cacheKey := CacheKey(req)
|
||||
outputContent := []byte("fake webp data")
|
||||
|
||||
err = cache.StoreVariant(cacheKey, bytes.NewReader(outputContent), "image/webp")
|
||||
err = cache.StoreVariant(
|
||||
t.Context(), cacheKey, bytes.NewReader(outputContent), "image/webp")
|
||||
if err != nil {
|
||||
t.Fatalf("StoreVariant() error = %v", err)
|
||||
}
|
||||
@@ -295,7 +296,8 @@ func TestCache_VariantLookup(t *testing.T) {
|
||||
cacheKey := CacheKey(req)
|
||||
outputContent := []byte("output data")
|
||||
|
||||
err := cache.StoreVariant(cacheKey, bytes.NewReader(outputContent), "image/webp")
|
||||
err := cache.StoreVariant(
|
||||
t.Context(), cacheKey, bytes.NewReader(outputContent), "image/webp")
|
||||
if err != nil {
|
||||
t.Fatalf("StoreVariant() error = %v", err)
|
||||
}
|
||||
@@ -344,7 +346,8 @@ func TestCache_GetVariant_ReturnsContentType(t *testing.T) {
|
||||
cacheKey := CacheKey(req)
|
||||
outputContent := []byte("output webp data")
|
||||
|
||||
err := cache.StoreVariant(cacheKey, bytes.NewReader(outputContent), "image/webp")
|
||||
err := cache.StoreVariant(
|
||||
t.Context(), cacheKey, bytes.NewReader(outputContent), "image/webp")
|
||||
if err != nil {
|
||||
t.Fatalf("StoreVariant() error = %v", err)
|
||||
}
|
||||
@@ -395,7 +398,8 @@ func TestCache_GetVariant(t *testing.T) {
|
||||
cacheKey := CacheKey(req)
|
||||
outputContent := []byte("the actual output content")
|
||||
|
||||
err := cache.StoreVariant(cacheKey, bytes.NewReader(outputContent), "image/webp")
|
||||
err := cache.StoreVariant(
|
||||
t.Context(), cacheKey, bytes.NewReader(outputContent), "image/webp")
|
||||
if err != nil {
|
||||
t.Fatalf("StoreVariant() error = %v", err)
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ func storeEvictionTestVariant(
|
||||
) {
|
||||
t.Helper()
|
||||
|
||||
err := cache.StoreVariant(key, bytes.NewReader(content), "image/webp")
|
||||
err := cache.StoreVariant(t.Context(), key, bytes.NewReader(content), "image/webp")
|
||||
if err != nil {
|
||||
t.Fatalf("StoreVariant(%s) failed: %v", key, err)
|
||||
}
|
||||
@@ -531,7 +531,7 @@ func assertDisabledCacheWritesAreNoOps(
|
||||
ctx := t.Context()
|
||||
|
||||
err := cache.StoreVariant(
|
||||
CacheKey(req), bytes.NewReader([]byte("data")), "image/webp",
|
||||
ctx, CacheKey(req), bytes.NewReader([]byte("data")), "image/webp",
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("StoreVariant on disabled cache must be a no-op, got error: %v", err)
|
||||
|
||||
@@ -425,7 +425,7 @@ func (s *Service) processAndStore(
|
||||
|
||||
// Store variant to cache
|
||||
err = s.cache.StoreVariant(
|
||||
cacheKey, bytes.NewReader(processedData), processResult.ContentType,
|
||||
ctx, cacheKey, bytes.NewReader(processedData), processResult.ContentType,
|
||||
)
|
||||
if err != nil {
|
||||
s.log.Warn("failed to store variant", "error", err)
|
||||
|
||||
Reference in New Issue
Block a user