Extract constant
The Extract Constant refactoring makes your source code easier to read and maintain. It also helps you avoid usage of hardcoded constants without any explanation about their values or purpose.
In the editor, select an expression or declaration of a variable you want to replace with a constant.
Press CtrlAlt0C to introduce a constant or select Refactor | Extract | Constant in the main menu.
note
By default, GoLand uses the in-place refactoring. To use the dialog for the refactoring, open the Settings dialog (CtrlAlt0S) , go to Editor | Code Editing, and select the In modal dialogs refactoring option in the Refactorings area.
Select an expression you want to extract as constant and press Enter. Select the number of occurrences you want to replace and a name you want to use.
Thanks for your feedback!