Choosing a Go module proxy in GoLand for reliable dependency resolution
Guide to decide between GoLand’s built‑in proxy, a custom proxy like Athens, or disabling the proxy, with a comparison table, trade‑offs, and step‑by‑step configuration and validation.
29 Jun 2026, 07:13 UTC

Decision and constraints
When working with Go modules in GoLand you must decide how the IDE resolves external dependencies. The choice affects offline work, compliance with corporate firewall rules, build determinism, and IDE startup performance. The three practical options are:
- Use GoLand’s built‑in module proxy (the default).
- Point to a custom proxy such as Athens or Goproxy.
- Disable the proxy and let Go contact version control systems directly.
Comparison of options
| Option | Offline support | Config complexity | Build determinism | IDE sync impact |
|---|---|---|---|---|
| Built‑in proxy | Yes (caches downloaded modules) | Low – no extra service | High – respects go.sum | Automatic, no restart needed |
| Custom proxy (e.g., Athens) | Yes, if the proxy mirrors the required versions | Medium – requires running and maintaining the proxy | High, when the proxy serves immutable versions | Requires IDE restart after changing the URL |
| No proxy (direct) | No – needs network for each missing module | None | Low – depends on network availability and VCS stability | None – fastest IDE start‑up |
Trade‑offs
The built‑in proxy offers zero‑configuration convenience and works for most teams, but its cache can become stale if you never clear it, potentially causing the IDE to use an older cached version when a newer one is required. A custom proxy gives you full control over version immutability, can host private internal modules, and lets you enforce corporate caching policies, at the cost of operating an extra service and configuring GoLand’s Settings → Go → Go Modules → Proxy field. Disabling the proxy yields the fastest IDE start‑up and eliminates any proxy‑related misconfiguration, but it breaks offline work and makes builds flaky because they depend on network reachability and the availability of remote VCS hosts.
Implementation
Using the built‑in proxy (default)
No action is required; GoLand already uses https://proxy.golang.org,direct unless you have changed it. To verify, open the Terminal pane (View → Tool Windows → Terminal) and run:
go env GOPROXY
The output should be exactly https://proxy.golang.org,direct.
Switching to a custom proxy
- Ensure your custom proxy is reachable from the workstation (e.g.,
https://athens.example.com). If it requires authentication, embed credentials in the URL (https://user:[contact removed]) or rely on.netrc/environment variables – GoLand does not expose a separate auth field. - Open
File → Settings(Windows/Linux) orGoLand → Preferences(macOS). - Navigate to
Go → Go Modules. - In the Go modules proxy field, replace the default value with your proxy URL, e.g.,
https://athens.example.com. - Optionally enable Use GOPROXY environment variable if you want the IDE to inherit the proxy from the shell’s
GOPROXYvariable. - Click Apply and then OK. GoLand will prompt to invalidate caches; accept to ensure the new setting takes effect immediately.
Disabling the proxy
- Follow the same path to
Settings → Go → Go Modules. - Clear the Go modules proxy field or set it to
direct. - Apply and invalidate caches when prompted.
Validation and verification
After changing the proxy, confirm that GoLand is using the intended value:
- In the Terminal pane, run
go env GOPROXY. The printed string must match the URL you entered (ordirectif disabled). - Trigger a module download, for example:
go list -m all
Observe the output lines; they should contain the proxy domain (e.g., athens.example.com) or show direct lines if the proxy is disabled.
To test offline capability:
- Disconnect the workstation from the network.
- Run a build that should have all dependencies already cached:
go build -v ./...
If the build succeeds, the proxy (or local cache) is providing the needed modules. If it fails with errors like cannot find module, the proxy is either misconfigured or does not have the required version cached.
Limitations and practical checks
- Changing the proxy after a project has been indexed may require File → Invalidate Caches to force GoLand to re‑scan dependencies with the new setting.
- GoLand’s UI only supports basic auth via URL encoding; for more advanced authentication mechanisms (OAuth, mTLS) you must rely on environment variables or
.netrcand ensure the Use GOPROXY environment variable option is enabled. - The built‑in proxy caches modules indefinitely; periodically run
go clean -modcachefrom the Terminal to remove stale entries if you notice version conflicts. - Custom proxies add an operational overhead: monitor their storage, keep them up‑stream with
https://proxy.golang.org, and verify that they serve immutable versions (e.g., by enabling storage‑level immutability or using a version‑controlled backend).
Rollback
Since changing the proxy modifies the IDE configuration, you can revert to the previous state by returning to Settings → Go → Go Modules and restoring the former proxy value (or clearing it to use the default). After applying the change, invalidate caches again to ensure the IDE picks up the old setting.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.