Projects
In GoLand, projects help you to organize your source code, tests, packages, build instructions, and your personal settings in a single unit.
Switch between projects
If you have several opened projects at the same time, you can switch between them using the following options:
Switch to the next project window: Control+Alt+] (
)Switch to the previous project window: Control+Alt+[ (
)
Alternatively, open the Window menu and select the project to which you want to switch.
Project formats
In GoLand, there are two types of formats in which a project's configuration can be stored — the file-based format and the directory-based format.
File-based format
The file-based format was the only one available in older versions of GoLand; now it is outdated. Projects in this format contain several files: the .ipr, .iws, and .iml files. Generally, we don't recommend using this format unless you need to open projects in different file managers by clicking the .ipr file, or unless you need to store multiple projects in one directory.
Directory-based format
For the directory-based format, the IDE creates the .iml file and the .idea directory that keeps project settings. It's the default format for projects in GoLand at this moment.
This format was introduced after the file-based format. Its main advantage is that it's adjusted to store project files in Version Control Systems: the project data is split over multiple files, and merge conflicts are less likely. For more information on how to share projects in different formats, refer to How to manage projects under Version Control Systems
Change the project format to directory-based
Open the project using the .ipr file: from the main menu, select and select the .ipr in the folder with the project that you want to convert.
When the project has opened, from the main menu, select
.
Change the IML file location for Go projects in IntelliJ IDEA
When you create a Go project in IntelliJ IDEA, you can specify a directory for the .iml file. The default location is the root directory of the project.
Change the IML file location for new Go projects
To create a new Go project, navigate to
.In the New Project wizard dialog, select Go and click Next.
Click More Settings.
In the Module file location field, add /.idea to the existing path.
If you want to change the IML file location for existing Go projects in IntelliJ IDEA, you need to modify the modules.xml file in the .idea directory.
Change the IML file location for existing Go projects
In the Project tool window, navigate to the .idea folder of the project.
Add .idea/ to
fileurl
andfilepath
attributes of the IML file location.Move the IML file to the .idea directory.
Change project location
Move a project to another location
In the Project tool window Alt+1, right-click the root directory of your project and select (F6).
In the dialog that opens, specify a new location for the project and click Refactor.
Change the default location for projects
In the Settings dialog (Control+Alt+S), select .
In the Default directory field, specify the path to the folder in which you want to store your projects.
Apply the changes and close the dialog.
Share project settings through VCS
Project settings are stored in the project directory as a set of XML files under the .idea folder. This folder contains both user-specific settings that shouldn't be placed under version control and project settings that are normally shared among developers working in a team, for example, the code style configuration.
When you place a project under version control, your personal settings are automatically ignored. GoLand moves workspace.xml — the file with your personal settings — to the list of ignored files to avoid conflicts with other developers' settings.
Configuration files are processed according to your choice. Once you modify the project settings, and a new configuration file is created, the IDE shows a notification at the bottom of the screen prompting you to select how you want to treat configuration files in this project:
View files: view the list of created configuration files and select, which of them you want to place under version control. After that, the selected files will be scheduled for addition to VCS.
Always Add: silently schedule all configuration files created in the .idea directory for addition to VCS (applies only to the current project).
Don't Ask Again: never schedule configuration files for addition to VCS; they will have the unversioned status until you manually add them to VCS (applies only to the current project).
If you close the notification without selecting any option, it will appear again after a new configuration file is created. The new file will also go to the list that will be there until you select one of the options even if you restart the IDE.
List of non-shareable configuration files
GoLand identifies configuration files and adds them to the list of ignored files automatically. However, if you are sharing your project manually, we recommend that you avoid placing these files and folders under version control:
.idea/workspace.xml
.idea/usage.statistics.xml
.idea/dictionaries folder
.idea/shelf folder
For the full list of files, refer to How to manage projects under Version Control Systems and JetBrains.gitignore.
Copy global settings to the project level
Global (IDE) settings are stored separately from projects. That is why these settings are not shared through version control together with the project.
Some settings, however, can be copied to the project level. For example, you can create a copy of your , inspection profiles, the list of classes and packages excluded from code completion and auto-import. If you do so, the IDE creates the corresponding configuration files in the .idea directory that you can share together with the project through VCS.
GoLand also provides several ways of sharing settings between different IDE instances. See Share IDE settings for details.
In this section:
Invalidate caches
GoLand caches a great number of files, therefore the system cache may become overloaded. Sometimes the caches will never be needed again, for example, if you work with frequent short-term projects.
When you invalidate the cache, GoLand rebuilds all projects ever run in the current version of the IDE.
Clear the system cache
From the main menu, select
.In the Invalidate Caches dialog, select an action. You can invalidate the caches and restart the IDE, invalidate the caches without restarting the IDE, or just restart the IDE.