Skip to content

Commit

Permalink
gitlab: use context
Browse files Browse the repository at this point in the history
fix unparam issues.
  • Loading branch information
haya14busa committed Jul 14, 2018
1 parent 70c5735 commit 865b112
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions gitlab_mr_commit.go
Expand Up @@ -92,7 +92,7 @@ func (g *GitLabMergeRequestCommitCommenter) postCommentsForEach(ctx context.Cont
Line: &comment.Lnum,
LineType: &ltype,
}
_, _, err = g.cli.Commits.PostCommitComment(g.projects, commitID, prcomment, nil)
_, _, err = g.cli.Commits.PostCommitComment(g.projects, commitID, prcomment, gitlab.WithContext(ctx))
return err
})
}
Expand Down Expand Up @@ -127,13 +127,15 @@ func (g *GitLabMergeRequestCommitCommenter) setPostedComment(ctx context.Context
}

func (g *GitLabMergeRequestCommitCommenter) comment(ctx context.Context) ([]*gitlab.CommitComment, error) {
commits, _, err := g.cli.MergeRequests.GetMergeRequestCommits(g.projects, g.pr, nil)
commits, _, err := g.cli.MergeRequests.GetMergeRequestCommits(
g.projects, g.pr, nil, gitlab.WithContext(ctx))
if err != nil {
return nil, err
}
comments := make([]*gitlab.CommitComment, 0)
for _, c := range commits {
tmpComments, _, err := g.cli.Commits.GetCommitComments(g.projects, c.ID, nil)
tmpComments, _, err := g.cli.Commits.GetCommitComments(
g.projects, c.ID, nil, gitlab.WithContext(ctx))
if err != nil {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion gitlab_mr_diff.go
Expand Up @@ -55,7 +55,7 @@ func (g *GitLabMergeRequestDiff) Diff(ctx context.Context) ([]byte, error) {
return g.gitDiff(ctx, g.sha, targetBranch.Commit.ID)
}

func (g *GitLabMergeRequestDiff) gitDiff(ctx context.Context, baseSha string, targetSha string) ([]byte, error) {
func (g *GitLabMergeRequestDiff) gitDiff(_ context.Context, baseSha string, targetSha string) ([]byte, error) {
b, err := exec.Command("git", "merge-base", targetSha, baseSha).Output()
if err != nil {
return nil, fmt.Errorf("failed to get merge-base commit: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion gitlab_mr_discussion.go
Expand Up @@ -85,7 +85,7 @@ func (g *GitLabMergeRequestDiscussionCommenter) createPostedCommetns() (postedco
}

func (g *GitLabMergeRequestDiscussionCommenter) postCommentsForEach(ctx context.Context, postedcs postedcomments) error {
mr, _, err := g.cli.MergeRequests.GetMergeRequest(g.projects, g.pr, nil)
mr, _, err := g.cli.MergeRequests.GetMergeRequest(g.projects, g.pr, nil, gitlab.WithContext(ctx))
if err != nil {
return fmt.Errorf("failed to get merge request: %v", err)
}
Expand Down

0 comments on commit 865b112

Please sign in to comment.