llms.txt: machine-readable documentation index. Markdown version of this page is also available.

IntelliJ IDEA 2026.2 Help

Go workspaces

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.

Create a workspace

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

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, 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.

Merge several use directives into one directive

  • Click a use directive, press Alt+Enter, and select Merge multiple 'use' directives into one.

17 September 2026