GoLand 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, GoLand automatically includes all modules in the current project.

Go workspaces

Create a workspace

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

    Create a workspace

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, GoLand creates a go.work file that includes the main module and its local replacements. Otherwise, it adds the replacements to the existing workspace.

    Generate go.work using replace directives

Merge several use directives into one directive

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

    Merge several use directives into one directive
03 April 2025