From 30eb2d3ad65d67095e5b5bc84b34a0c7b5fd9f03 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 26 May 2020 17:08:34 -0700 Subject: [PATCH] Fix test --- command/pr_diff.go | 3 +-- command/pr_lookup.go | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/command/pr_diff.go b/command/pr_diff.go index c39c491a4..22217b35b 100644 --- a/command/pr_diff.go +++ b/command/pr_diff.go @@ -42,9 +42,8 @@ func prDiff(cmd *cobra.Command, args []string) error { } pr, err := prFromArgs(ctx, baseRepo, args...) - if err != nil { - return err + return fmt.Errorf("could not find pull request: %w", err) } diff, err := apiClient.PullRequestDiff(baseRepo, pr.Number) diff --git a/command/pr_lookup.go b/command/pr_lookup.go index 48cd824ff..7f169ff77 100644 --- a/command/pr_lookup.go +++ b/command/pr_lookup.go @@ -22,9 +22,8 @@ func prFromArgs(ctx context.Context, repo ghrepo.Interface, args ...string) (*ap return prForCurrentBranch(ctx, repo) } - prString := args[0] - // First check to see if the prString is a url + prString := args[0] pr, err := prFromURL(ctx, repo, prString) if pr != nil || err != nil { return pr, err @@ -37,8 +36,7 @@ func prFromArgs(ctx context.Context, repo ghrepo.Interface, args ...string) (*ap } // Last see if it is a branch name - pr, err = api.PullRequestForBranch(apiClient, repo, "", prString) - return pr, err + return api.PullRequestForBranch(apiClient, repo, "", prString) } func prFromNumberString(ctx context.Context, repo ghrepo.Interface, s string) (*api.PullRequest, error) {