# Inline

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

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

Use the Inline refactoring to reverse the extract refactoring for a method or a variable.

Procedure:

1. Place the caret at the code fragment you want to inline.

2. Press `Ctrl+Alt+N` (Windows), `⌘ ⌥ N` (macOS), `⌘ ⌥ N` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ N` (macOS System Shortcuts), `Ctrl+Alt+N` (XWin), `Ctrl+Alt+N` (GNOME), `Ctrl+Alt+N` (KDE), `Ctrl+Alt+N` (Emacs), `Ctrl+Alt+N` (Sublime Text), `⌘ ⌥ N` (Sublime Text (macOS)), `Ctrl+Alt+N` (VSCode), `⌘ ⌥ N` (VSCode (macOS)). Alternatively, right-click the code fragment and select the inline refactoring that you need from the `Refactor` menu.

3. In the  dialog, specify the options.

4. (Optional) Select Preview to preview changes.

5. Preview and apply changes.

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

Currently, GoLand provides the Inline Function refactoring, which is opposite to the [Extract method](extract-method.html) refactoring.

## Examples

### Inline Variable

Inline Variable refactoring replaces redundant variable usage with its initializer.

| Before | After |
| --- | --- |
|     ```GO func main() { 	subj := subject{name: "world"} 	format := "hello %s" 	fmt.Printf(format, subj.name) } ```    |     ```GO func main() { 	subj := subject{name: "world"} 	fmt.Printf("hello %s", subj.name) } ```    |

### Inline Function/Method

Inline Function/Method results in placing the method's body into the body of its caller(s).

| Before | After |
| --- | --- |
|     ```GO package main  import "fmt"  func main() { 	fmt.Println(<caret>hello()) 	print(hello()) }  func hello() string { 	return "Hello World!" } ```    |    Inline all invocations and remove declaration      ```GO package main  import "fmt"  func main() { 	fmt.Println(<caret>"Hello World!") 	print("Hello World!") } ```     Inline all invocations and keep declaration      ```GO package main  import "fmt"  func main() { 	fmt.Println(<caret>"Hello World!") 	print("Hello World!") }  func hello() string { 	return "Hello World!" } ```     Inline this invocation only and keep declaration      ```GO package main  import "fmt"  func main() { 	fmt.Println(<caret>"Hello World!") 	print(hello()) }  func hello() string { 	return "Hello World!" } ```    |

## See also

### Procedures

[Code refactoring](refactoring-source-code.html)

