This guide will help you set up your development environment for contributing to analyzer-lsp.
- Prerequisites
- Initial Setup
- Installing LSP Servers
- Building the Project
- IDE Configuration
- Debugging
- Troubleshooting
| Tool | Version | Purpose |
|---|---|---|
| Go | 1.23+ | Build analyzer and Go-based providers |
| Podman or Docker | Latest | Container-based testing and external providers |
| Make | Any | Build automation |
| Git | Any | Version control |
| Tool | Version | Purpose |
|---|---|---|
| Java | 17+ | Java provider development and testing |
| Node.js | 18+ | Node.js/TypeScript provider |
| Python | 3.9+ | Python provider |
| npm | Latest | Installing Node.js language servers |
| pip | Latest | Installing Python language servers |
- Disk Space: At least 5GB for images and build artifacts
- RAM: 8GB minimum, 16GB recommended for running all providers
- OS: Linux, macOS, or Windows (with WSL2)
git clone https://github.com/konveyor/analyzer-lsp.git
cd analyzer-lspgo version
# Should show: go version go1.23.x or higherIf Go is not installed:
Linux:
wget https://go.dev/dl/go1.23.9.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.23.9.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/binmacOS:
brew install goWindows (WSL2):
wget https://go.dev/dl/go1.23.9.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.23.9.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/binpodman --version
# or
docker --versionIf Podman is not installed:
Linux:
# Fedora/RHEL
sudo dnf install podman
# Ubuntu/Debian
sudo apt-get install podmanmacOS:
brew install podman
podman machine init
podman machine startWindows: Install Docker/Podman Desktop with WSL2 backend
make --versionLSP servers enable language-specific analysis. Install the ones you need for development.
Required for: Go provider
go install golang.org/x/tools/gopls@latest
# Verify installation
gopls versionConfiguration: gopls is usually auto-configured. For custom settings, create ~/.config/gopls/settings.json:
{
"gofumpt": true,
"staticcheck": true
}Required for: Python provider
python3 -m pip install 'python-lsp-server>=1.8.2'
# Verify installation
pylsp --versionOptional plugins:
python3 -m pip install python-lsp-server[all]Required for: Node.js/TypeScript provider
npm install -g typescript typescript-language-server
# Verify installation
typescript-language-server --versionRequired for: Java provider
Note: JDTLS is bundled in the Java provider container image. For local development, you can use the containerized version.
If you need JDTLS locally:
- Download jdtls
- Extract to a directory (e.g.,
~/jdtls) - Set path in provider configuration
Required for: YAML provider
The YAML provider uses yq which is bundled in the container. For local testing:
# macOS
brew install yq
# Linux
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq
sudo chmod +x /usr/local/bin/yqmake analyzerOutput: build/konveyor-analyzer
Build all components:
make buildThis creates in build/:
konveyor-analyzer- Main analyzer CLIkonveyor-analyzer-dep- Dependency analyzer CLIgeneric-external-provider- Go/Python/Node.js providergolang-dependency-provider- Go dependency provideryq-external-provider- YAML providerjava-external-provider- Java provider
Build the main analyzer image:
make image-buildBuild all external provider images:
make build-externalThis builds:
localhost/analyzer-lsp:latestlocalhost/java-provider:latestlocalhost/generic-provider:latestlocalhost/golang-dep-provider:latestlocalhost/yq-provider:latest
# Generic provider (Go/Python/Node.js)
make external-generic
# Java provider
make java-external-provider
# YAML provider
make yq-external-provider
# Go dependency provider
make golang-dependency-providerCross-compile for different platforms:
# Linux AMD64
GOOS=linux GOARCH=amd64 make analyzer
# macOS ARM64
GOOS=darwin GOARCH=arm64 make analyzer
# Windows
GOOS=windows GOARCH=amd64 make analyzerWorkspace settings (.vscode/settings.json):
{
"go.useLanguageServer": true,
"go.lintTool": "golangci-lint",
"go.testFlags": ["-v"],
"go.buildFlags": [],
"files.watcherExclude": {
"**/build/**": true
}
}Debug configuration (.vscode/launch.json):
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Analyzer",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/cmd/analyzer/main.go",
"args": [
"--rules=rule-example.yaml",
"--provider-settings=provider_settings.json",
"--output-file=debug-output.yaml"
]
},
{
"name": "Debug Tests",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${workspaceFolder}/engine"
}
]
}-
Open project: File → Open → Select
analyzer-lspdirectory -
Configure Go SDK: File → Settings → Go → GOROOT
-
Run Configuration:
- Run → Edit Configurations
- Add → Go Build
- Package path:
github.com/konveyor/analyzer-lsp/cmd/analyzer - Program arguments:
--rules=rule-example.yaml --provider-settings=provider_settings.json
Install gopls and configure with vim-go or coc.nvim:
" .vimrc / init.vim
let g:go_def_mode='gopls'
let g:go_info_mode='gopls'- Set breakpoints in code
- Press F5 or use Debug → Start Debugging
- Analyzer runs with configured arguments
# Install delve
go install github.com/go-delve/delve/cmd/dlv@latest
# Debug analyzer
dlv debug ./cmd/analyzer/main.go -- \
--rules=rule-example.yaml \
--provider-settings=provider_settings.json \
--output-file=debug-output.yaml
# In delve:
(dlv) break main.main
(dlv) continue
(dlv) next
(dlv) print variableNameSet verbose logging:
go run cmd/analyzer/main.go \
--verbose=9 \
--rules=rule-example.yaml \
--provider-settings=provider_settings.jsonLog levels:
0-2- Errors only3-5- Warnings and info6-9- Debug and trace
Run provider standalone:
# Generic provider (Go example)
./build/generic-external-provider \
--port 14653 \
--name gopls
# In another terminal, attach analyzer
go run cmd/analyzer/main.go \
--provider-settings=local_provider_settings.json \
--rules=rule-example.yaml# Start provider with logs
podman run -it --rm \
-p 14651:14651 \
localhost/java-provider:latest \
--port 14651
# View logs in real-time
podman logs -f java-providerEnable LSP tracing:
# Set environment variable
export LSP_LOG_PATH=/tmp/lsp.log
# Run analyzer
go run cmd/analyzer/main.go --verbose=9 ...
# View LSP traffic
tail -f /tmp/lsp.logEnable Jaeger tracing:
# Start Jaeger (using Docker)
docker run -d --name jaeger \
-p 16686:16686 \
-p 14268:14268 \
jaegertracing/all-in-one:latest
# Run analyzer with tracing
go run cmd/analyzer/main.go \
--enable-jaeger \
--jaeger-endpoint=http://localhost:14268/api/traces \
--rules=rule-example.yaml
# View traces at http://localhost:16686Problem: cannot find module providing package
Solution:
go mod tidy
go mod downloadProblem: sed: illegal option on macOS
Solution: macOS uses BSD sed. Either:
# Install GNU sed
brew install gnu-sed
# Or run build commands directly
cd external-providers/generic-external-provider
go build -o ../../build/generic-external-provider main.goProblem: Error: image not found
Solution:
# Rebuild images
make image-build
make build-externalProblem: bind: address already in use
Solution:
# Find process using port
lsof -i :14651
# or
netstat -tuln | grep 14651
# Kill process or change port in provider_settings.jsonProblem: exec: "gopls": executable file not found in $PATH
Solution:
# Ensure GOBIN is in PATH
export PATH=$PATH:$(go env GOPATH)/bin
# Reinstall gopls
go install golang.org/x/tools/gopls@latestIf you encounter issues:
- Check existing GitHub Issues
- Review CONTRIBUTING.md
- Join Konveyor community discussions
- Open a new issue with:
- OS and version
- Go version (
go version) - Steps to reproduce
- Error messages and logs
Useful environment variables for development:
# Go build settings
export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0
# Go module proxy
export GOPROXY=https://proxy.golang.org,direct
# Testing
export PODMAN_USERNS=keep-id # For rootless podmanOnce your environment is set up:
- Run the test suite:
make test-all - Try running the analyzer:
go run cmd/analyzer/main.go - Read the Testing Guide to understand the test infrastructure
- Review the Architecture to understand the codebase
- See Provider Development to build new providers
Typical development workflow:
# 1. Create a feature branch
git checkout -b feature/my-feature
# 2. Make changes to code
# 3. Run unit tests
go test ./...
# 4. Build locally
make build
# 5. Run E2E tests
make test-all
# 6. Commit changes
git add .
git commit -m "Add my feature"
# 7. Push and create PR
git push origin feature/my-feature# Use build cache
go build -o build/konveyor-analyzer ./cmd/analyzer# Run tests in parallel
go test -parallel 4 ./...
# Cache test results
go test -count=1 ./... # disable cache
go test ./... # use cache# Use layer caching
podman build --layers -t analyzer-lsp .
# Multi-stage builds are already optimized in Dockerfiles