GoLand 2020.3 Help

Move Refactorings

Perform copy refactoring

You can create a copy of a file, directory or a package in a different directory or a package.

  1. Select an identifier that you want to refactor (for example, a file in the Project tool window). Alternatively, place a caret anywhere in your code.

  2. Select Refactor | Copy F5

  3. In the Copy window, 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.

  1. Select an identifier that you want to refactor.

  2. Select Refactor | Move (or press F6 ).

  3. In the Move window, you see a list of declarations that you can move along with the item. Select all the necessary declarations.

  4. Specify a path to the target directory, a filename, and a package name.

    Example of the Move refactoring

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.

Move private identifiers
    Last modified: 08 March 2021