Use the Rename refactoring to change names of symbols, files, and all the references to them throughout code.
Renaming local variables or private methods can be done easily inline since only the limited scope is affected. Renaming types, interfaces, or public methods could potentially impact a lot of files. Preview potential changes before you refactor.
Rename code in place
In the editor start renaming a parameter, a method, or other code element. GoLand will display in the gutter.
Click the gutter icon or press ⌥+Enter and apply a suggestion.
GoLand renames the code element and updates its usages accordingly.
Invoke Rename refactoring
In the editor, select an element you want to rename. If you need to rename a file, select one in the Project tool window.
Press ⇧+F6 or from the main menu, select.
You can perform the rename refactoring in-place or press ⇧+F6 again to open the Rename dialog. Enter a new name of the element to enable the Preview and Refactor buttons.
You can specify additional options. For example, specify where to search for element occurrences, or what else to rename. You can also specify a scope for the refactoring.
In the Refactoring Preview dialog, review potential changes and click Do Refactor.
Next time you invoke the Rename refactoring, GoLand remembers the options you have specified inside the Rename dialog.
Rename methods in interfaces
You can rename methods that are declared in interfaces. When you rename the method, GoLand displays a context menu where you can select to rename method implementations as well.
Right-click a method in an interface and select. Alternatively, position the caret at the method in the interface and press ⇧+F6.
In context menu select what you want to rename. To rename the method and all implementations, select Refactor method specification and all implementations. Otherwise, to refactor only selected method, select Refactor only current method.
In the Change Signature dialog, change the method name in the Name field.
To preview your changes before refactoring, click Preview.