# Extract/Introduce variable

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/go/2026.3/llms.txt).

> **TL;DR**
> `Refactor | Extract | Extract Variable`
>
>
>
> `Ctrl+Alt+V` (Windows), `⌘ ⌥ V` (macOS), `⌘ ⌥ V` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ V` (macOS System Shortcuts), `Ctrl+Alt+V` (XWin), `Ctrl+Alt+V` (GNOME), `Alt+Shift+V` (KDE), `Ctrl+Alt+V` (Emacs), `Ctrl+Alt+V` (Sublime Text), `Ctrl+Alt+V` (Sublime Text (macOS)), `Ctrl+Alt+V` (VSCode), `⌘ ⌥ V` (VSCode (macOS))

If you come across an expression that is hard to understand, or it is duplicated in several places throughout your code, the Extract Variable refactoring `Ctrl+Alt+V` (Windows), `⌘ ⌥ V` (macOS), `⌘ ⌥ V` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ V` (macOS System Shortcuts), `Ctrl+Alt+V` (XWin), `Ctrl+Alt+V` (GNOME), `Alt+Shift+V` (KDE), `Ctrl+Alt+V` (Emacs), `Ctrl+Alt+V` (Sublime Text), `Ctrl+Alt+V` (Sublime Text (macOS)), `Ctrl+Alt+V` (VSCode), `⌘ ⌥ V` (VSCode (macOS)) can help you deal with those problems by placing the result of such expression or its part into a separate variable that is less complex and easier to understand. Plus, it reduces the code duplication.

You can use the Introduce Variable refactoring to extract variadic arguments into a new slice variable.

Procedure: Extract a variable

1. In the editor, select an expression or its part that you want to extract . You can also place the caret within the expression, in this case GoLand offers you a list of potential code selections.

2. Press `Ctrl+Alt+V` (Windows), `⌘ ⌥ V` (macOS), `⌘ ⌥ V` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ V` (macOS System Shortcuts), `Ctrl+Alt+V` (XWin), `Ctrl+Alt+V` (GNOME), `Alt+Shift+V` (KDE), `Ctrl+Alt+V` (Emacs), `Ctrl+Alt+V` (Sublime Text), `Ctrl+Alt+V` (Sublime Text (macOS)), `Ctrl+Alt+V` (VSCode), `⌘ ⌥ V` (VSCode (macOS)) or go to `Refactor | Extract/Introduce | Variable` in the main menu.

GoLand also displays ![the Gear icon](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.settings.svg) next to a variable that you can use to configure more options.

If GoLand finds more than one occurrence, it lets you specify a scope and extract just a part of the found occurrences and not just all of them.

3. Select a name suggested in the popup or type your own and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (VSCode), `⏎` (VSCode (macOS)).

[Video](https://resources.jetbrains.com/help/img/idea/2026.3/go_extract_variable.mp4)

