Copy and move refactorings
Perform copy refactoring
You can create a copy of a file, directory or a package in a different directory or a package.
Select an identifier that you want to refactor (for example, a file in the Project tool window). Alternatively, place the caret anywhere in your code.
In the main menu, go to or press F5.
In the Copy dialog, specify the name and location for your copy, and click OK.
Perform move refactoring
You can move source code sections to another package or a file. Also, you can move a file or a folder in the Project tool window.
Select an identifier that you want to refactor.
In the main menu, go to or press F6.
In the Move window, you see a list of declarations that you can move along with the item. Select all the necessary declarations.
Specify a path to the target directory, a filename, and a package name.
Move private identifiers
Sometimes when you move an identifier that is not exported (a private identifier), the identifier becomes inaccessible for the source package (from which we perform the move).
GoLand displays a notification when the identifier is private and is not exported during the move operation. Before you apply code changes, consider reviewing them by using the Preview button.

Reference for dialog controls
Item | Description |
|---|---|
Declarations | Specify declarations that you want to move along with the identifier. When you move an identifier that has a related comment section, the move refactoring moves the comment section along with the identifier. |
To directory | Specify the directory that will store the selected identifiers. |
To file | Specify a name of a package that will store the selected identifiers. |
To package | Specify a name of a package that will store the selected identifiers. |
Refactor | Click the button to start the move refactoring. |
Preview | Click the button to preview all the changes that you are about to perform in the Find tool window. |
Cancel | Click the button to cancel the move refactoring. |