refactor(merge_requests): move method comments to the interface
This is the follow-up I promised in !3101.
Today no method in MergeRequestsServiceInterface has a doc comment. The docs are only on the MergeRequestsService methods. Callers who use the interface (or the mocks in testing/) do not see the method docs in their editor or in go doc.
I moved the existing doc comments of all 34 merge request methods onto the interface, the same way it was already done for jobs, users and projects. The comment text stays the same.
The GitLab API docs links changed. Many headings on the merge requests API page were renamed, so the old anchors no longer exist. For example, "Get single MR" is now "Retrieve a merge request". I updated the 13 old anchors on the interface methods and the 8 on the options and diff version types. Now every anchor in the file points to a heading that exists.
GetMergeRequestChangeskeeps itsDeprecated:note on the method too, not only on the interface. This is how the deprecated methods in jobs and error tracking do it, so staticcheck still warns callers who use the concrete type.- I did not touch
CancelAutoMerge. It is added by !3101 with its doc already on the interface. Whichever of the two MRs merges second needs a small rebase on the interface block, and I will do it.
How I tested
On main, the interface block has no comments at all. On this branch, go doc . MergeRequestsServiceInterface prints the docs for every method, with 34 GitLab API docs links:
type MergeRequestsServiceInterface interface {
// ListMergeRequests gets all merge requests. The state parameter can be used
// to get only merge requests with a given state (opened, closed, or merged)
// or all of them (all). The pagination parameters page and per_page can be
// used to restrict the list of merge requests.
//
// GitLab API docs:
// https://docs.gitlab.com/api/merge_requests/#list-merge-requests
ListMergeRequests(opt *ListMergeRequestsOptions, options ...RequestOptionFunc) ([]*BasicMergeRequest, *Response, error)I compared the removed and the added comment lines in the diff. The only differences are the doc links and the deprecation note that is now in both places.
To check the links, I took doc/api/merge_requests.md and doc/api/merge_request_approvals.md from the GitLab master branch, turned every heading into its anchor, and looked up each #anchor used in merge_requests.go. All 55 anchors match a heading.
gofmt -l and gofumpt -l on the file, go build . and go vet . printed nothing. I ran the mockgen line for MergeRequestsServiceInterface again, and the mock had no diff.
The rest runs in the pipeline.
Implemented with AI assistance; I reviewed and tested the changes.