Skip to content

Rename "id" parameter to "commentID" in comment-related methods of IssuesService. #885

@dmitshur

Description

@dmitshur

The endpoints that touch comments in IssuesService are very different from ones that touch issues. Comment-related endpoints take the comment ID (an int64 now), while issue-related endpoints use the issue number (an int):

IssuesService.Get       (ctx context.Context, owner string, repo string, number int) (*Issue, *Response, error)
IssuesService.GetComment(ctx context.Context, owner string, repo string, id int64)   (*IssueComment, *Response, error)

Using the name id for the parameter can be misleading. People can think it refers to the issue ID.

This problem is exacerbated in the EditComment endpoints because they take an id int64 and the *github.IssueComment itself also contains an ID int64 (but setting it has no effect; it's there for the Get/List operations, not Edit).

GistsService sets a good example by calling the parameter commentID in its GetComment method:

GistsService.GetComment(ctx context.Context, gistID string, commentID int64) (*GistComment, *Response, error)

I think we should rename id to commentID in IssuesService to make it more clear.

(I've also noticed a similar issue in PullRequestsService and its comment-related methods, but I'll make that a separate issue.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions