Gopls LSP
/install gopls-lsp
gopls LSP
Go language server integration providing comprehensive code intelligence through gopls (the official Go language server).
Capabilities
- Code intelligence: Autocomplete, go-to-definition, find references
- Error detection: Real-time diagnostics for compilation errors and issues
- Refactoring: Rename symbols, extract function, organize imports
- Analysis: Static analysis, code suggestions, unused code detection
- Supported extensions:
.go
Installation
Install gopls using the Go toolchain:
go install golang.org/x/tools/gopls@latest
Important: Make sure $GOPATH/bin (or $HOME/go/bin) is in your PATH.
Verify installation:
gopls version
Usage
The language server runs automatically in LSP-compatible editors. For manual operations:
Format code
gofmt -w file.go
Run linter
go vet ./...
Build and test
go build ./...
go test ./...
Configuration
Create gopls.yaml in your project or workspace for custom settings:
analyses:
unusedparams: true
shadow: true
completeUnimported: true
staticcheck: true
Or configure via environment:
export GOPLS_CONFIG='{"staticcheck": true, "analyses": {"unusedparams": true}}'
Integration Pattern
When editing Go code:
- gopls provides real-time diagnostics in LSP editors
- Run
go fmtorgofmtto format code - Use
go vetfor additional static analysis - Run tests with
go testbefore committing
Common Go Commands
go mod init \x3Cmodule>- Initialize Go modulego mod tidy- Clean up dependenciesgo get \x3Cpackage>- Add dependencygo build- Compile packagesgo run main.go- Run programgo test- Run testsgo vet- Report suspicious constructs
More Information
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install gopls-lsp - After installation, invoke the skill by name or use
/gopls-lsp - Provide required inputs per the skill's parameter spec and get structured output
What is Gopls LSP?
Go language server (gopls) providing code intelligence, refactoring, and analysis for .go files. Use when working with Go code that needs autocomplete, go-to-definition, find references, error detection, or refactoring support. It is an AI Agent Skill for Claude Code / OpenClaw, with 1213 downloads so far.
How do I install Gopls LSP?
Run "/install gopls-lsp" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Gopls LSP free?
Yes, Gopls LSP is completely free (open-source). You can download, install and use it at no cost.
Which platforms does Gopls LSP support?
Gopls LSP is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Gopls LSP?
It is built and maintained by bowen31337 (@bowen31337); the current version is v1.0.0.