Lab 13: Plugin Architecture
Overview
Step 1: Go plugin Package
plugin Package// plugin/greeter/main.go — compiled as shared library
package main
// Exported symbol: must be package-level variable or function
var PluginName = "greeter-v1"
func Greet(name string) string {
return "Hello, " + name + "! (from plugin)"
}
// Build:
// go build -buildmode=plugin -o greeter.so ./plugin/greeter/
// Limitations:
// - Same Go version (exact match required)
// - Linux/macOS only (no Windows)
// - Cannot unload (process-lifetime)
// - Plugin and host must use same module path for shared typesStep 2: Plugin Interface Contract
Step 3: hashicorp/go-plugin — Production Plugins
Step 4: Hot Reload Plugin Pattern
Step 5: WASM-Based Plugins
Step 6: Capability-Based Security
Step 7: Plugin Registry
Step 8: Capstone — Plugin Build and Load
Summary
Approach
Isolation
Cross-Platform
Reload
Last updated
