Extract a function or a method
In the editor, select an expression or its part that you want to extract. You can also position the caret within the expression, in this case GoLand offers you a list of potential code selections.
Press Ctrl+Alt+M or on the main menu, select.
Type a method name and press Enter.