git-agent for Gogit-agent understands Go module boundaries, interface changes, and test file conventions, producing accurate conventional commits that align with Go project standards.
diff --git a/internal/cache/redis.go b/internal/cache/redis.go
index 4d2e9f1..1a3b8c7 100644
--- a/internal/cache/redis.go
+++ b/internal/cache/redis.go
@@ -8,12 +8,25 @@ import (
"context"
"encoding/json"
"time"
+ "fmt"
"github.com/redis/go-redis/v9"
)
+// ErrCacheMiss is returned when the requested key is not present in the cache.
+var ErrCacheMiss = fmt.Errorf("cache: key not found")
+
type Client struct {
rdb *redis.Client
}
-func (c *Client) Get(ctx context.Context, key string) ([]byte, error) {
- return c.rdb.Get(ctx, key).Bytes()
+func (c *Client) Get(ctx context.Context, key string) ([]byte, error) {
+ b, err := c.rdb.Get(ctx, key).Bytes()
+ if err == redis.Nil {
+ return nil, ErrCacheMiss
+ }
+ return b, err
}feat(cache): expose sentinel ErrCacheMiss from Redis client
- add package-level ErrCacheMiss sentinel so callers can use errors.Is
- translate redis.Nil to ErrCacheMiss inside Get to hide driver details
- document the new error var with a godoc comment
Callers previously had to import go-redis directly to check for
redis.Nil; the sentinel decouples the cache package's public API from
its underlying driver.brew install gitagenthq/tap/git-agent
# inside your Go module
git-agent init # reads go.mod module path to suggest scopesDoes git-agent handle go.sum changes separately?go get are grouped into a chore(deps) commit, separate from your code changes.Can git-agent work inside a Go workspace with multiple modules?How does git-agent handle generated protobuf files in Go?