Review code in Space
The Space plugin allows you to invite your colleagues to review code and discuss changes directly in GoLand. With the Space plugin, you can:
Create a code review if you want your colleagues to review specific commits.
Create a merge request if you want your colleagues to review the comparison of two branches.
Review code if you were invited to a code review, or join existing reviews.
Create code reviews
A code review lets your teammates review the changes made in scope of selected commits.
In the Log tab.
tool window, select theRight-click a commit and select search field and filters.
. To narrow down the list of commits, you can use theIn the Code Reviews tool window that opens, enter a meaningful title for your code review and assign reviewers.
Click Create Code Review.
Create merge requests
A merge request is a special type of code review, which lets you compare two branches and invite your colleagues to review it.
From the main menu, select
.In the Code Reviews tool window that opens, click and select Create Merge Request.
Select the source and target branches. By default, the currently checked out branch is selected as the source branch, and the configured main branch as the target.
Enter a meaningful title and assign reviewers.
Click Create Merge Request.
Review tools
In GoLand, you can use the Code Reviews tool window to browse available reviews, the Timeline pane to view the history of a review, and the Diff pane to preview changes and post line comments.
Code Reviews tool window
If your code is hosted on Space, the Code Reviews tool window opens automatically. It is also available via the menu or by clicking your profile picture on the right side of the toolbar.
The Code Reviews shows all code reviews of your Space project. The list of code reviews available in Code Reviews depends on the repository that is currently opened in GoLand. Selecting a code review opens its main page with the following tabs:
Details: shows the author and reviewers. For code reviews, this also shows the branch, which is under review; for merge requests, it shows the source and target branches.
Files: list of files to be reviewed. If a file contains line comments, their count is also displayed here. You can select a file to open the Diff pane.
Commits: select a commit to narrow down the scope of displayed changes. Or right-click a commit and select Show in Git Log to view commit details and history in the Git log.
Timeline pane
The Timeline pane appears in the editor when you open a code review or a merge request. It lists all comments and events related to the review. You can post general comments here.
Diff pane
The Diff pane appears in the editor when you select a file. It is a regular GoLand Difference viewer, which shows the comparison between the previous and the current version of the file. With the Space plugin, you can use it to post line comments.
Review code
In Space, a typical code review process involves two roles: an author and a reviewer. Both participants can view code, post comments, and reply to them. While reviewing the code, you can post two types of comments:
On the Timeline pane: general comments (or review comments), which are not attached to any file or part of code. You can start a thread by replying to general comments.
On the Diff pane: line comments, which are used to discuss a particular line of code. You can reply to line comments to continue the discussion. You can then resolve and reopen these discussions.
When you post a comment, a notification is sent to the other party of the review. If you don't want to disturb other participants before you are finished reviewing or revising, you can save your comments as drafts and submit them all at once when you're done.
All comments in GoLand and in the Space web version are instantly synchronized, so you can continue discussions wherever you like. To format your text, you can use the Markdown syntax.
Find a code review
In the Code Reviews tool window, filter reviews by their state, type, author, or reviewer.
You can also use quick filters () to quickly apply filters to the review list:
Open: all open reviews in your project.
Includes my changes: all open code reviews where you are the author.
Needs my attention: open code reviews where you are the author, and it's your turn.
Needs my review: open code reviews where you are a reviewer, and it's your turn.
Assigned to me: open and closed reviews in which you participate as a reviewer.
Closed: all closed reviews in your project.
Click a code review to open its details, view commits, and post comments.
Post a general comment
In the Code Reviews tool window, select a review.
In the Timeline pane that opens, enter your comment and press Enter.
If it's your turn in the review, you can also select how to post the comment:
Select Post now if you want to notify the review participants immediately.
Select Save as Draft if you do not want to post this comment right now. Draft comments will be automatically posted when you complete your turn in the review.
Post a line comment
In the Code Reviews tool window, select a review.
In the Files tab, double-click a file that you want to open for comments. You can then use the tab to narrow down the list of changes.
Hover over a line of code and click . To select multiple lines, click a line of code and drag your cursor up or down.
Enter your comment and press Enter.
If it's your turn in the review, you can also select how to post the comment:
Select Post now if you want to notify the review participants immediately.
Select Save as Draft if you do not want to post this comment right now. Draft comments will be automatically posted when you complete your turn in the review.
Mark files as viewed or not viewed
Files that have not been reviewed yet are marked with a blue dot on the Files tab. If you open the file diff, it is considered as viewed. You can mark files as viewed and not viewed to keep track of what remains to review.
In the Code Reviews tool window, select a review.
Open the Files tab.
Right-click a file and in the context menu click Mark as Viewed or Mark as Not Viewed.
Mention people
In general and line comments, you can mention users of your Space organization to invite them to discussions. They will then receive a message in Space Chats.
While writing a comment, enter @.
Select a user from the list.
Complete your turn in a review
If you are a reviewer in a turn-based review, you are usually supposed to complete your turn by either accepting the changes or requesting additional information from the author. When you complete your turn, draft comments become visible to other participants of the review. For a detailed description of turn-based reviews, refer to Space documentation.
In the Code Reviews tool window, select a review.
On the Details tab, select how you want to complete the review:
Click Wait for Response if you want to come back to this review later; for example, you expect the author to make changes and want to review them.
Click Accept if you accept the changes.
These two buttons also display the count of your line comments that are saved as drafts and are not yet visible to other participants of the review.
If you have selected the Wait for Response option, it will now be the author's turn to review your comments and send the review back to you. You can repeat this process until both of you accept the changes.
Currently, closing a review and merging a branch are not supported in GoLand; you can close reviews and merge branches using the web version of Space.
Quit a review
You can quit a review if, for example, you no longer participate in it and don't want to receive notifications on new comments.
In the Code Reviews tool window, select a review.
Click Leave review.