diff --git a/api/client.go b/api/client.go index 14fb246d4..6231fa13a 100644 --- a/api/client.go +++ b/api/client.go @@ -36,7 +36,7 @@ type Client struct { http *http.Client } -func (c *Client) HTTP() *http.Client { +func (c Client) HTTP() *http.Client { return c.http } diff --git a/api/queries_issue.go b/api/queries_issue.go index d545ef59f..2a88ec7fa 100644 --- a/api/queries_issue.go +++ b/api/queries_issue.go @@ -75,7 +75,7 @@ const ( TypePullRequest string = "PullRequest" ) -func (i Issue) IsPullRequest() bool { +func (i *Issue) IsPullRequest() bool { return i.Typename == TypePullRequest } @@ -411,14 +411,14 @@ func IssueStatus(client *Client, repo ghrepo.Interface, options IssueStatusOptio return &payload, nil } -func (i Issue) Link() string { +func (i *Issue) Link() string { return i.URL } -func (i Issue) Identifier() string { +func (i *Issue) Identifier() string { return i.ID } -func (i Issue) CurrentUserComments() []Comment { +func (i *Issue) CurrentUserComments() []Comment { return i.Comments.CurrentUserComments() } diff --git a/api/queries_pr.go b/api/queries_pr.go index e9c733816..384ca8b86 100644 --- a/api/queries_pr.go +++ b/api/queries_pr.go @@ -299,26 +299,26 @@ type PullRequestFile struct { ChangeType string `json:"changeType"` } -func (pr PullRequest) HeadLabel() string { +func (pr *PullRequest) HeadLabel() string { if pr.IsCrossRepository { return fmt.Sprintf("%s:%s", pr.HeadRepositoryOwner.Login, pr.HeadRefName) } return pr.HeadRefName } -func (pr PullRequest) Link() string { +func (pr *PullRequest) Link() string { return pr.URL } -func (pr PullRequest) Identifier() string { +func (pr *PullRequest) Identifier() string { return pr.ID } -func (pr PullRequest) CurrentUserComments() []Comment { +func (pr *PullRequest) CurrentUserComments() []Comment { return pr.Comments.CurrentUserComments() } -func (pr PullRequest) IsOpen() bool { +func (pr *PullRequest) IsOpen() bool { return pr.State == "OPEN" } diff --git a/api/queries_repo.go b/api/queries_repo.go index d358255d8..4e056df55 100644 --- a/api/queries_repo.go +++ b/api/queries_repo.go @@ -248,22 +248,22 @@ type GitIgnore struct { } // RepoOwner is the login name of the owner -func (r Repository) RepoOwner() string { +func (r *Repository) RepoOwner() string { return r.Owner.Login } // RepoName is the name of the repository -func (r Repository) RepoName() string { +func (r *Repository) RepoName() string { return r.Name } // RepoHost is the GitHub hostname of the repository -func (r Repository) RepoHost() string { +func (r *Repository) RepoHost() string { return r.hostname } // ViewerCanPush is true when the requesting user has push access -func (r Repository) ViewerCanPush() bool { +func (r *Repository) ViewerCanPush() bool { switch r.ViewerPermission { case "ADMIN", "MAINTAIN", "WRITE": return true @@ -273,7 +273,7 @@ func (r Repository) ViewerCanPush() bool { } // ViewerCanTriage is true when the requesting user can triage issues and pull requests -func (r Repository) ViewerCanTriage() bool { +func (r *Repository) ViewerCanTriage() bool { switch r.ViewerPermission { case "ADMIN", "MAINTAIN", "WRITE", "TRIAGE": return true diff --git a/pkg/cmd/pr/shared/editable.go b/pkg/cmd/pr/shared/editable.go index d294329ba..8900cf62d 100644 --- a/pkg/cmd/pr/shared/editable.go +++ b/pkg/cmd/pr/shared/editable.go @@ -225,7 +225,7 @@ func (e Editable) MilestoneId() (*string, error) { // Clone creates a mostly-shallow copy of Editable suitable for use in parallel // go routines. Fields that would be mutated will be copied. -func (e *Editable) Clone() Editable { +func (e Editable) Clone() Editable { return Editable{ Title: e.Title.clone(), Body: e.Body.clone(), diff --git a/pkg/cmd/pr/shared/survey.go b/pkg/cmd/pr/shared/survey.go index 4eae2cde0..69874127b 100644 --- a/pkg/cmd/pr/shared/survey.go +++ b/pkg/cmd/pr/shared/survey.go @@ -149,12 +149,12 @@ type RepoMetadataFetcher interface { RepoMetadataFetch(api.RepoMetadataInput) (*api.RepoMetadataResult, error) } -func MetadataSurvey(p Prompt, io *iostreams.IOStreams, baseRepo ghrepo.Interface, fetcher RepoMetadataFetcher, state *IssueMetadataState, projectsV1Support gh.ProjectsV1Support, reviewerSearchFunc func(string) prompter.MultiSelectSearchResult) error { +func MetadataSurvey(p Prompt, io *iostreams.IOStreams, baseRepo ghrepo.Interface, fetcher RepoMetadataFetcher, state *IssueMetadataState, projectsV1Support gh.ProjectsV1Support, reviewerSearchFunc func(string) prompter.MultiSelectSearchResult) error { //nolint:gocyclo isChosen := func(m string) bool { for _, c := range state.Metadata { if m == c { return true - } //nolint:gocyclo + } } return false } diff --git a/pkg/cmd/run/shared/shared.go b/pkg/cmd/run/shared/shared.go index 8c191846a..d3c98dadd 100644 --- a/pkg/cmd/run/shared/shared.go +++ b/pkg/cmd/run/shared/shared.go @@ -140,7 +140,7 @@ type Commit struct { } // Title is the display title for a run, falling back to the commit subject if unavailable -func (r Run) Title() string { +func (r *Run) Title() string { if r.DisplayTitle != "" { return r.DisplayTitle } @@ -155,7 +155,7 @@ func (r Run) Title() string { // WorkflowName returns the human-readable name of the workflow that this run belongs to. // TODO: consider lazy-loading the underlying API data to avoid extra API calls unless necessary -func (r Run) WorkflowName() string { +func (r *Run) WorkflowName() string { return r.workflowName }