GoLand 2024.3 Help

Configuring folders within a content root

Within a content root, GoLand can distinguish between Resource Root and Excluded folders.

  • Resource roots the Resources root icon are intended for resource files in your application (images, Style Sheets, and so on). By assigning a folder to this category, you tell GoLand that files in it and in its subfolders can be referenced relative to this folder instead of specifying full paths to them.

  • Excluded the Excluded root icon contain files and folders ignored by GoLand when indexing, searching, parsing, watching, and so on.

Files in the folder that is marked as resource root can be referenced relative to this folder. Excluded folders are not involved in indexing and therefore they are ignored while searching, parsing, watching, and other operations.

Marking directories

You can assign a folder to a category in two different ways:

  • In settings (Ctrl+Alt+S), under the Project Structure menu item.

  • In the Project tool window, by using the context menu of a folder.

Attach a directory to the project

  1. Click File | Open.

  2. In the file browser, navigate to the directory that you want to attach.

  3. Click Open.

  4. In the Open Project dialog, click Attach.

    Attach Directory

Detach a directory from the project

  • Right-click a directory that you want to detach and select Remove from Project View.

Mark directories under the content root

  1. In the Settings dialog (Ctrl+Alt+S) , select Project Structure.

  2. On the Project Structure page, click the desired content root. Directories under this content root are displayed as a tree view in the right-hand pane.

  3. Select the directory and use its context menu or the Mark as toolbar to mark it as one of the following:

    • Excluded root Excluded: GoLand ignores Excluded folders during indexing, parsing, code completion, and so on.

    • Resource root Resource Root: GoLand completes relative paths to resources under the Resource Root folder.

    Add Content Root

Mark directories in the Project tool window

  1. Right-click the desired directory in the Project tool window.

  2. From the context menu, point to Mark Directory As node.

  3. Choose Mark as <directory status>.

Mark directories in the Project tool window

Reset the folder status

To reset a folder to its regular status, you need to unmark it.

  1. Open settings (Ctrl+Alt+S) and click Project Structure.

  2. Select the directory in the list of folders under the content root, and click the remove button Unmark source root. Alternatively, you can right-click the folder in the Project tool window Alt+1 and navigate to Mark directory as | Cancel Exclusion.

Reset the folder status
Last modified: 22 November 2024