summaryrefslogtreecommitdiff
path: root/internal/git/noop.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-18 08:47:27 +0300
committerPaul Buetow <paul@buetow.org>2026-04-18 08:47:27 +0300
commit60f717b97ce6c375679080472750e60aab9dcd8f (patch)
treeb1028ea0e51ce6134ed3ea06da2a7205457319c5 /internal/git/noop.go
parent526e3bd1bea7e2ef67c6984b91cdb9b3ac3be4e5 (diff)
refactor: move Gitter interface to consumer package internal/cli (task p6)
Per Go best practice (100 Go Mistakes #6): interfaces belong where they are used, not where they are implemented. Move Gitter from internal/git to internal/cli/git.go. Compile-time assertions (var _ Gitter = ...) kept in the new location. internal/git retains concrete *Git and *NoOp types. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/git/noop.go')
-rw-r--r--internal/git/noop.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/internal/git/noop.go b/internal/git/noop.go
index 44dc68c..f125644 100644
--- a/internal/git/noop.go
+++ b/internal/git/noop.go
@@ -9,7 +9,7 @@ import (
// because the kdbx file is not inside a git repository.
const noOpMessage = "kdbx file is not in a git repo; skipping"
-// NoOp is a Gitter implementation whose every method prints an informational
+// NoOp is a no-op git client whose every method prints an informational
// message and returns nil. It is used when the KeePass database file lives
// outside of a git repository so that sync/status/commit/reset commands remain
// functional and transparent rather than crashing or returning errors.
@@ -17,11 +17,12 @@ const noOpMessage = "kdbx file is not in a git repo; skipping"
// Keeping the no-op behaviour in its own type (rather than nil-checking in the
// CLI dispatch) respects the Open/Closed Principle: the CLI is open for
// extension (new backends, new git behaviours) without modification.
+//
+// NoOp satisfies the Gitter interface defined in internal/cli (the consumer),
+// not here in the producer — per Go best practice #6 from 100 Go Mistakes.
+// The compile-time assertion lives in internal/cli/git.go.
type NoOp struct{}
-// Compile-time assertion: *NoOp must satisfy Gitter.
-var _ Gitter = (*NoOp)(nil)
-
// NewNoOp returns a *NoOp that satisfies Gitter with all operations being
// informational no-ops.
func NewNoOp() *NoOp {