[FEATURE] Support gopls daemon mode to share single instance across multiple Claude Code sessions
Resolved 💬 2 comments Opened Jan 20, 2026 by corylanou Closed Jan 20, 2026
Problem
When running multiple Claude Code sessions working on Go code, each session spawns its own gopls instance. With many concurrent sessions, this leads to severe memory consumption:
- Each gopls instance uses ~500-800MB RAM
- 10 sessions = ~5-8GB just for gopls
- 40+ sessions = ~20-30GB of RAM consumed by gopls alone
This is a significant issue for users who work with multiple Claude Code sessions simultaneously (which is common for parallel task workflows).
Proposed Solution
gopls natively supports a daemon mode that allows multiple clients to share a single gopls instance:
# Instead of spawning a new gopls per session:
gopls serve
# Use daemon mode - connects to shared instance, auto-starts if needed:
gopls -remote=auto -remote.listen.timeout=30m
How it works:
- First client auto-starts a gopls daemon process
- Subsequent clients connect to the existing daemon via Unix socket
- All clients share the same gopls instance and its cache
- Daemon auto-shuts down after configurable timeout with no clients
Benefits:
- Memory: 40 sessions would use ~500MB total instead of ~20GB
- Startup: Subsequent sessions connect instantly (no gopls startup delay)
- Cache sharing: All sessions benefit from shared analysis cache
Implementation
The change would be in the gopls-lsp plugin configuration. Instead of:
{
"command": "gopls",
"args": ["serve"]
}
Use:
{
"command": "gopls",
"args": ["-remote=auto", "-remote.listen.timeout=30m"]
}
References
From the official gopls daemon documentation:
"A single, persistent, shared gopls daemon process is responsible for managing all gopls sessions."
"Editors still start a gopls sidecar, but this sidecar merely acts as a thin forwarder, responsible for forwarding the LSP to the shared gopls instance."
Key benefits documented:
- ✅ "Single cache shared across multiple editor sessions"
- ✅ "Reduced memory vs. separate processes"
- ✅ "No startup cost for subsequent editor sessions"
The -remote=auto flag handles everything automatically:
"This will cause this process to auto-start the gopls daemon if needed, connect to it, and forward the LSP."
Documentation links:
Environment
- macOS (Apple Silicon)
- Claude Code with gopls-lsp plugin
- Multiple concurrent Claude Code sessions
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗