command
module
Version:
v0.0.0-...-6631669
Opens a new window with list of versions in this module.
Published: Nov 17, 2025
License: Unlicense
Opens a new window with license information.
Imports: 5
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
go-plugin-tryout
trying out plugin mechanisms:
on windows, run:
demo.bat
on *X:
./demo.sh
Plugin Approaches Comparison
hashicorp/go-plugin (RPC-based)
Pros:
- ✅ Cross-platform: Works on all platforms (Windows, Linux, macOS)
- ✅ Process isolation: Plugins run in separate processes, providing better isolation and crash protection
- ✅ Version flexibility: Can work with different Go versions between host and plugin
- ✅ Network support: Can run plugins over network
- ✅ Better error handling: Process crashes don't affect the main application
Cons:
- ❌ Performance overhead: RPC communication adds latency compared to in-process calls
- ❌ Resource usage: Each plugin runs as a separate process
- ❌ Complexity: Requires more boilerplate code (RPC wrappers, handshake configs)
- ❌ Startup time: Process spawning adds initialization overhead
golang.org/pkg/plugin (Native)
Pros:
- ✅ Performance: Direct in-process calls, no RPC overhead
- ✅ Low latency: Function calls are as fast as regular Go function calls
- ✅ Resource efficiency: Shared memory space, no separate processes
- ✅ Simplicity: Simpler API, less boilerplate code
Cons:
- ❌ Platform limitations: NOT supported on Windows/amd64 (see demo.bat line 15)
- ❌ Go version lock: Plugin and host must be compiled with the same Go version
- ❌ No isolation: Plugin crashes can bring down the main application
- ❌ Build constraints: Requires
-buildmode=plugin flag and platform-specific file extensions (.so, .dylib)
| Platform |
hashicorp/go-plugin |
golang.org/pkg/plugin |
| Linux |
✅ |
✅ |
| macOS |
✅ |
✅ |
| Windows |
✅ |
❌ (not supported) |
Structure
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.