From 44ad36bb393585235042493f75b6c68d7d51732f Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 7 Jun 2024 14:48:47 +0200 Subject: Add type assertions for all searchable contexts We want to add an additional method to ISearchableContext later in this branch, and this will make sure that we don't forget to implement it in any concrete context. --- pkg/gui/context/commit_files_context.go | 5 +++-- pkg/gui/context/local_commits_context.go | 5 +++-- pkg/gui/context/patch_explorer_context.go | 5 ++++- pkg/gui/context/sub_commits_context.go | 5 +++-- pkg/gui/context/working_tree_context.go | 5 ++++- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/pkg/gui/context/commit_files_context.go b/pkg/gui/context/commit_files_context.go index 88dac8b45..d6df67a10 100644 --- a/pkg/gui/context/commit_files_context.go +++ b/pkg/gui/context/commit_files_context.go @@ -18,8 +18,9 @@ type CommitFilesContext struct { } var ( - _ types.IListContext = (*CommitFilesContext)(nil) - _ types.DiffableContext = (*CommitFilesContext)(nil) + _ types.IListContext = (*CommitFilesContext)(nil) + _ types.DiffableContext = (*CommitFilesContext)(nil) + _ types.ISearchableContext = (*CommitFilesContext)(nil) ) func NewCommitFilesContext(c *ContextCommon) *CommitFilesContext { diff --git a/pkg/gui/context/local_commits_context.go b/pkg/gui/context/local_commits_context.go index 0458c401b..d92f71ff6 100644 --- a/pkg/gui/context/local_commits_context.go +++ b/pkg/gui/context/local_commits_context.go @@ -18,8 +18,9 @@ type LocalCommitsContext struct { } var ( - _ types.IListContext = (*LocalCommitsContext)(nil) - _ types.DiffableContext = (*LocalCommitsContext)(nil) + _ types.IListContext = (*LocalCommitsContext)(nil) + _ types.DiffableContext = (*LocalCommitsContext)(nil) + _ types.ISearchableContext = (*LocalCommitsContext)(nil) ) func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext { diff --git a/pkg/gui/context/patch_explorer_context.go b/pkg/gui/context/patch_explorer_context.go index 34f70e2c7..dac66fa03 100644 --- a/pkg/gui/context/patch_explorer_context.go +++ b/pkg/gui/context/patch_explorer_context.go @@ -18,7 +18,10 @@ type PatchExplorerContext struct { mutex *deadlock.Mutex } -var _ types.IPatchExplorerContext = (*PatchExplorerContext)(nil) +var ( + _ types.IPatchExplorerContext = (*PatchExplorerContext)(nil) + _ types.ISearchableContext = (*PatchExplorerContext)(nil) +) func NewPatchExplorerContext( view *gocui.View, diff --git a/pkg/gui/context/sub_commits_context.go b/pkg/gui/context/sub_commits_context.go index 736fb88b5..8e2b5ace1 100644 --- a/pkg/gui/context/sub_commits_context.go +++ b/pkg/gui/context/sub_commits_context.go @@ -21,8 +21,9 @@ type SubCommitsContext struct { } var ( - _ types.IListContext = (*SubCommitsContext)(nil) - _ types.DiffableContext = (*SubCommitsContext)(nil) + _ types.IListContext = (*SubCommitsContext)(nil) + _ types.DiffableContext = (*SubCommitsContext)(nil) + _ types.ISearchableContext = (*SubCommitsContext)(nil) ) func NewSubCommitsContext( diff --git a/pkg/gui/context/working_tree_context.go b/pkg/gui/context/working_tree_context.go index 4f7bfabff..17ff31de3 100644 --- a/pkg/gui/context/working_tree_context.go +++ b/pkg/gui/context/working_tree_context.go @@ -15,7 +15,10 @@ type WorkingTreeContext struct { *SearchTrait } -var _ types.IListContext = (*WorkingTreeContext)(nil) +var ( + _ types.IListContext = (*WorkingTreeContext)(nil) + _ types.ISearchableContext = (*WorkingTreeContext)(nil) +) func NewWorkingTreeContext(c *ContextCommon) *WorkingTreeContext { viewModel := filetree.NewFileTreeViewModel( -- cgit v1.2.3