A Go library for hot-reloading code without restarting servers, built on Go's plugin mechanism.
Hotswap is a Go library that enables hot-reloading of code in production servers without requiring restarts or interrupting ongoing procedures. It solves the problem of downtime during deployments by allowing developers to update Go applications live, using Go's plugin mechanism as a foundation. The library provides isolation between plugin versions and tools for managing asynchronous jobs with the latest code.
Go developers building long-running server applications (e.g., web servers, APIs, microservices) who need to update code without downtime. It's particularly useful for teams practicing continuous deployment or working on applications where restarting is costly.
Developers choose Hotswap because it offers a complete, safe solution for hot-reloading in Go—a feature not natively supported by the language. Its unique selling points include plugin version isolation, support for static linking for debugging, and built-in mechanisms for handling asynchronous jobs with live code.
A complete solution to reload your go code without restarting your server, interrupting or blocking any ongoing procedure.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables live code updates without restarting servers or interrupting ongoing procedures, essential for production environments with continuous deployment needs, as stated in the core feature of reloading without blocking.
Runs different versions of a plugin in complete isolation to prevent conflicts during reloads, ensuring safer updates in production, as highlighted in the features.
Supports static linking for plugins, making debugging possible on macOS and Windows with tools like delve, demonstrated in the 'slink' demo for easier troubleshooting.
Provides live functions, live types, and live data to manage asynchronous jobs with the latest code versions, reducing staleness issues in long-running applications, as explained in the Live Things section.
Live plugin reloading is not supported on Windows due to Go's plugin mechanism, limiting cross-platform use and requiring static linking for debugging only, as noted in the FAQ.
Plugins must avoid global variables, long-running goroutines, and define specific lifecycle functions like OnLoad and OnInit, which can be error-prone and restrictive for complex logic.
Requires building with CGO_ENABLED=1, using git and go modules, and adhering to a hierarchical structure, adding overhead compared to simpler hot-reload solutions.