CommitGen
Commit messages from your staged changes, suggested as you type.
Try it
$
Staged diff
internal/auth/token.go
+ var (mu sync.Mutex; cached string; expiry time.Time)
+ // Token returns the cached token, refreshing it once it expires.
+ if time.Now().Before(expiry) { return cached }
+ expiry = time.Now().Add(10 * time.Minute) $
Staged diff
docs/setup.md + ## Setup + Run `make install`, then `commitgen init`.
$
Staged diff
internal/auth/token.go
+ if cached == "" { return refresh() }
internal/auth/token_test.go (new)
+ func TestToken(t *testing.T) { if Token() == "" { t.Fatal("empty token") } }