English | ç®€ä½“ä¸æ–‡
A Go-based file monitoring and hot-reload tool that automatically watches for file changes, compiles your Go applications, and restarts them during development. Similar to nodemon for Node.js, SoHot streamlines your Go development workflow by eliminating manual build and restart cycles.
- Intelligent File Watching: Monitors specified directories for changes with configurable include/exclude patterns
- Smart Compilation: Delayed compilation mechanism prevents excessive rebuilds during rapid file changes
- Hot Reload: Automatically restarts your application after successful compilation
- Interactive Configuration: Choose between multiple run profiles with an intuitive command-line interface
- Run-Only Mode: Monitor and restart pre-built executables without recompilation
- Cross-Platform: Works on Windows, macOS, and Linux with platform-specific optimizations
- Structured Logging: Comprehensive logging with configurable levels using zerolog
- Process Management: Graceful process termination and cleanup with signal handling
- Go 1.23.1 or later
- Git (for cloning the repository)
git clone https://github.com/qwenode/sohot.git
cd sohot
go build -o sohot
go install github.com/qwenode/sohot@latest
- Create a configuration file (
sohot.toml
) in your project root:
[log]
level = -1
[watch]
include = ["."]
exclude = ["tmp/", "vendor/"]
[build]
delay = 1000
name = "./tmp/app"
package = "main.go"
command = []
[run.dev]
command = ["--port", "8080"]
[run.prod]
only = true
command = ["--env", "production"]
- Start SoHot:
# Interactive mode - choose profile
sohot
# Direct mode - specify profile name
sohot dev
- Start developing - SoHot will automatically rebuild and restart your application when files change.
SoHot uses a TOML configuration file (sohot.toml
) with the following sections:
[log]
level = -1 # Log level (-1: trace, 0: debug, 1: info, 2: warn, 3: error, 4: fatal)
[watch]
include = ["."] # Directories to monitor
exclude = ["tmp/"] # Directories to exclude (*.git, .idea, *.exe automatically excluded)
[build]
delay = 1000 # Compilation delay in milliseconds
name = "./tmp/test.exe" # Output executable path
package = "main.go" # Main package path
command = [] # Additional build arguments
Define multiple run configurations for different environments:
[run.development]
command = ["--debug", "--port", "3000"]
[run.production]
only = true # Run-only mode (no compilation)
command = ["--env", "prod"]
[run.testing]
only = true
command = ["--test-mode"]
- command: Array of command-line arguments to pass to your application
- only: Boolean flag for run-only mode (monitors executable file instead of source files)
[watch]
include = ["."]
exclude = ["static/", "tmp/"]
[build]
delay = 500
name = "./tmp/server"
package = "cmd/server/main.go"
[run.dev]
command = ["--port", "8080", "--debug"]
[run.local]
command = ["--config", "local.yaml"]
[run.staging]
only = true
command = ["--config", "staging.yaml", "--log-level", "info"]
[run.debug]
only = true
command = ["--config", "debug.yaml", "--pprof"]
[run.production]
only = true
command = ["--env", "production", "--workers", "4"]
Please use the GitHub issue tracker to report bugs or request features. Include:
- Go version
- Operating system
- Configuration file (if relevant)
- Steps to reproduce
- Expected vs actual behavior
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with excellent Go libraries from the community
- Thanks to all contributors and users
Happy coding with SoHot! 🔥