From 60f717b97ce6c375679080472750e60aab9dcd8f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 18 Apr 2026 08:47:27 +0300 Subject: 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 --- internal/git/git_test.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'internal/git/git_test.go') diff --git a/internal/git/git_test.go b/internal/git/git_test.go index 462c747..4c22fec 100644 --- a/internal/git/git_test.go +++ b/internal/git/git_test.go @@ -283,11 +283,14 @@ func TestIsGitRepo_outside(t *testing.T) { } } -// TestNoOp_satisfies_Gitter verifies that *git.NoOp compiles as a Gitter and -// that all its methods return nil (no-op, no error) so they are safe to call -// unconditionally from CLI dispatch. -func TestNoOp_satisfies_Gitter(t *testing.T) { - var g git.Gitter = git.NewNoOp() +// TestNoOp_methods verifies that all *git.NoOp methods return nil (no-op, no +// error) so they are safe to call unconditionally from CLI dispatch. +// +// Note: the Gitter interface is defined in internal/cli (the consumer), not +// here in internal/git (the producer), per Go best practice #6. The +// compile-time assertion that *NoOp satisfies Gitter lives in internal/cli/git.go. +func TestNoOp_methods(t *testing.T) { + g := git.NewNoOp() ctx := context.Background() table := []struct { -- cgit v1.2.3