GoLand project reload: go mod download runs for all modules on every open

Problem

Opening or reopening a project with a large number of Go modules in GoLand triggers the go mod download command for all modules each time the project is loaded. This occurs both when starting the IDE and when closing and reopening a project without restarting GoLand. This leads to repeated downloads which can impact performance for projects with many modules.

Cause

GoLand is designed to refresh module dependencies by running go mod download every time the project is loaded, to ensure all dependencies are up to date in case module versions have changed while the project was not loaded. This behavior is not limited to full IDE restarts and also occurs when just reopening the project.

Resolution

Disable automatic dependency downloads by navigating to Settings | Go | Go Modules and unchecking “Download Go modules dependencies”. When this option is disabled, go mod download will not run automatically on project load. Note: After disabling, new or modified dependencies must be downloaded manually via the intention action on imports or by running go mod download in the terminal. Until dependencies are downloaded, code completion and symbol resolution will not work for those packages.

If go mod download continues to run after disabling the setting, check the GoLand version via Help | About and update to the latest version if necessary. An older build may have a bug causing downloads to run even when the option is off.

You can follow progress on optimizing this behavior in GO-15053, which suggests switching to go mod tidy for automatic downloads to reduce unnecessary traffic and file changes.

0 out of 0 found this helpful

Please sign in to leave a comment.

Have more questions?

Submit a request