A go:generate tool that builds Go 1.8+ plugins and generates typed API wrappers for exported symbols.
go-bind-plugin is a Go tool that generates typed API wrappers around exported symbols (functions and variables) in Go 1.8 plugins. It automates the boilerplate of loading plugins and performing type assertions, providing a cleaner and safer interface for plugin consumption. This eliminates manual symbol lookups and reduces runtime errors.
Go developers building or consuming plugins with Go 1.8's plugin system, particularly those who need type safety and reduced boilerplate when integrating plugin functionality into their applications.
Developers choose go-bind-plugin because it generates type-safe code that passes go vet and golint, ensures symbol validation and integrity checks, and offers zero runtime overhead compared to native plugin calls. Its ability to generate interfaces instead of structs also facilitates mocking and multiple plugin implementations.
go-bind-plugin generates API for exported plugin symbols (-buildmode=plugin) - go1.8+ only (http://golang.org/pkg/plugin)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Automatically generates Go structs or interfaces with properly typed methods, eliminating manual type assertions and symbol lookups as shown in the README's code comparison example.
Ensures exported symbols exist and match expected types during plugin loading, preventing runtime errors and increasing safety.
Embeds and validates plugin SHA256 checksums with the -sha256 flag, ensuring binary integrity and protecting against tampering.
Generates interfaces instead of structs using the -interface flag, facilitating easier mocking and multiple plugin implementations for testing.
Benchmarks in the README show no additional performance cost for method calls compared to native plugin usage, maintaining efficiency.
Relies on Go's plugin system which is limited to Linux and requires exact Go version and build flag matches, making it unsuitable for cross-platform or version-heterogeneous environments.
Uses reflection to infer types from plugin symbols, which may fail for complex or unexported types, and adds a dependency that could break with Go updates.
Requires integration into go:generate workflows and proper flag configuration, adding setup overhead and potential errors in CI/CD pipelines.