# Go workspaces

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

> **TL;DR**
> Go 1.18 or later is required.

A Go workspace uses a `go.work` file to work with multiple modules in one project. The file lists the modules that Go treats as main modules when it resolves dependencies.

When you create a `go.work` file, IntelliJ IDEA automatically includes all modules in the current project.

Procedure: Create a workspace

* Right-click the parent directory of your project. Then select `New | Go Workspace File`.

Procedure: Add local replacement modules to a workspace

* In a `go.mod` file that contains relative `replace` directives for modules in the project, place the caret at a directive, press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (NetBeans), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)), and select Add all locally replaced modules to workspace.

If no workspace exists, IntelliJ IDEA creates a `go.work` file that includes the main module and its local replacements. Otherwise, it adds the replacements to the existing workspace.

Procedure: Merge several use directives into one directive

* Click a `use` directive, press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (NetBeans), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)), and select Merge multiple 'use' directives into one.

