git-agent for GoConventional commits for Go modules and services
git-agent understands Go module boundaries, interface changes, and test file conventions, producing accurate conventional commits that align with Go project standards.
diff example
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
}git-agent output
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.Why it works for Go
- Understands Go module boundaries and suggests scopes from go.mod
- Separates *_test.go changes into test commits automatically
- Recognises interface definition changes versus implementation changes
- Works with multi-module Go workspaces (go.work)
install
brew install gitagenthq/brew/git-agent
# inside your Go module
git-agent init # reads go.mod module path to suggest scopesFAQ
Does git-agent handle go.sum changes separately?Yes. go.sum and go.mod updates triggered by
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?Yes. git-agent operates at the git repository root. If your repo contains a go.work file, each module directory is treated as a potential separate scope.
How does git-agent handle generated protobuf files in Go?Protobuf generated files (*.pb.go) are recognised as generated code. git-agent groups them into a separate chore or build commit rather than mixing them with hand-written changes.