Eletrize is a live reload tool for Go and other languages. It watches for file changes in your project and automatically runs commands, speeding up development and testing workflows.
English | Português
Requirements:
- Go 1.23 or later
To install Eletrize, run:
go install github.com/lasfh/eletrize@latestRun a simple command with file watching:
eletrize run [run] [build] [flags]
# Example:
eletrize run ./server "go build -o server" --ext=.go,.mod --label="API" --env=.envThis command:
- Watches the directory for changes in
.goand.modfiles. - Runs
go build -o serverand./serverwhen changes are detected. - Loads environment variables from the
.envfile.
Eletrize can automatically detect configuration files named:
eletrize.ymleletrize.yaml.eletrize.yml.eletrize.yamleletrize.json.eletrize.json.eletrize(JSON format)
To run Eletrize with a config file:
eletrizeOr specify the path manually:
eletrize path/eletrize.ymlIf your config file contains multiple schemas, you can specify one using:
eletrize eletrize.yml --schema=1Replace 1 with the desired schema index.
schema:
- label: API
workdir: ""
envs:
key: "value"
env_file: ".env"
watcher:
path: "."
recursive: true
excluded_paths:
- "frontend"
extensions:
- ".go"
commands:
build:
method: "go"
args:
- "build"
envs:
key: "value"
env_file: ""
run:
- method: "./server"
envs:
PORT: "8080"
env_file: ""Eletrize can automatically detect and use VSCode launch configurations from .vscode/launch.json. This feature allows you to leverage your existing VSCode debug configurations for live reloading.
To use VSCode launch detection:
eletrizeEletrize will automatically detect:
- Go launch configurations with
"type": "go","request": "launch", and"mode": "auto" - Program path (supports
${workspaceFolder}variable) - Environment variables and environment files
- Command line arguments
Example .vscode/launch.json:
{
"configurations": [
{
"name": "Launch Server",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/server",
"args": ["--port", "8080"],
"envFile": "${workspaceFolder}/.env",
"env": {
"DEBUG": "true"
}
}
]
}This configuration will be automatically converted to watch .go files and run the server with live reloading.
Display help information.
eletrize help [command]Both tools are great for live reloading, but they have different focuses:
| Feature | Eletrize | Air |
|---|---|---|
| Language Support | Agnostic (Go, Rust, Node, etc) | Go Focused |
| VSCode Integration | Native (Reads launch.json) |
Manual config required |
| Configuration | YAML, JSON (Multiple schemas) | TOML |
| Multi-folder | Yes (Monorepo readiness) | Limited |
Why choose Eletrize? If you work with multiple languages or want zero-config integration with your VSCode debugger, Eletrize is the way to go.
This project is licensed under the MIT License.