From 5ed83e2b2a6279710eb140271e840ab6a9fb66ad Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Wed, 27 Apr 2022 23:58:34 -0700 Subject: [PATCH] Remove `Stringer` from `ghrepo.Interface` (#5536) --- api/queries_repo.go | 5 ----- internal/ghrepo/repo.go | 5 ----- internal/ghrepo/repo_test.go | 5 ----- pkg/cmd/label/clone.go | 4 ++-- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/api/queries_repo.go b/api/queries_repo.go index 6064036ff..a287b6557 100644 --- a/api/queries_repo.go +++ b/api/queries_repo.go @@ -215,11 +215,6 @@ func (r Repository) RepoHost() string { return r.hostname } -// String returns the OWNER/NAME of the repository -func (r Repository) String() string { - return fmt.Sprintf("%s/%s", r.Owner.Login, r.Name) -} - // ViewerCanPush is true when the requesting user has push access func (r Repository) ViewerCanPush() bool { switch r.ViewerPermission { diff --git a/internal/ghrepo/repo.go b/internal/ghrepo/repo.go index 72457b3f0..cb969ef94 100644 --- a/internal/ghrepo/repo.go +++ b/internal/ghrepo/repo.go @@ -11,7 +11,6 @@ import ( // Interface describes an object that represents a GitHub repository type Interface interface { - fmt.Stringer RepoName() string RepoOwner() string RepoHost() string @@ -145,7 +144,3 @@ func (r ghRepo) RepoName() string { func (r ghRepo) RepoHost() string { return r.hostname } - -func (r ghRepo) String() string { - return fmt.Sprintf("%s/%s", r.owner, r.name) -} diff --git a/internal/ghrepo/repo_test.go b/internal/ghrepo/repo_test.go index c9802cbcf..46fa37827 100644 --- a/internal/ghrepo/repo_test.go +++ b/internal/ghrepo/repo_test.go @@ -217,11 +217,6 @@ func TestFromFullName(t *testing.T) { if r.RepoName() != tt.wantName { t.Errorf("expected name %q, got %q", tt.wantName, r.RepoName()) } - - wantString := fmt.Sprintf("%s/%s", tt.wantOwner, tt.wantName) - if r.String() != wantString { - t.Errorf("String() expected %q, got %q", wantString, r.String()) - } }) } } diff --git a/pkg/cmd/label/clone.go b/pkg/cmd/label/clone.go index aa5d24246..6478c2e71 100644 --- a/pkg/cmd/label/clone.go +++ b/pkg/cmd/label/clone.go @@ -96,9 +96,9 @@ func cloneRun(opts *cloneOptions) error { switch { case successCount == totalCount: - fmt.Fprintf(opts.IO.Out, "%s Cloned %s from %s to %s\n", cs.SuccessIcon(), pluralize(successCount), opts.SourceRepo, ghrepo.FullName(baseRepo)) + fmt.Fprintf(opts.IO.Out, "%s Cloned %s from %s to %s\n", cs.SuccessIcon(), pluralize(successCount), ghrepo.FullName(opts.SourceRepo), ghrepo.FullName(baseRepo)) default: - fmt.Fprintf(opts.IO.Out, "%s Cloned %s of %d from %s to %s\n", cs.WarningIcon(), pluralize(successCount), totalCount, opts.SourceRepo, ghrepo.FullName(baseRepo)) + fmt.Fprintf(opts.IO.Out, "%s Cloned %s of %d from %s to %s\n", cs.WarningIcon(), pluralize(successCount), totalCount, ghrepo.FullName(opts.SourceRepo), ghrepo.FullName(baseRepo)) } }