Skip to content
Go 1.8 lightning talk for plugins
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Go 1.8 lightning talk

  • A plugin is a shared object that can be loaded at run time.
  • Plugins are cached after being initialized.
  • Safe to use in multiple goroutines
  • Currently only works on linux :(

Load a plugin like this:

p, err := plugin.Open("")
if err != nil {

Access exported variables and functions (Symbols) like this:

symbol, err := p.Lookup("Symbol")
if err != nil {

building a pluging:

go build -buildmode=plugin


Here is an example of an RPC server that loads up the correct procedure lazily.

go build -buildmode=plugin -o plugins/ plugins/hello.go
go build -buildmode=plugin -o plugins/ plugins/do_it.go
go run main.go

Play around with removing the .so files and hitting these urls

curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: 8c453945-6848-cf8c-4b27-eac133b10c3c" -d '{
	"Type": "do_it",
	"Args": [
		"wat is happens"
}' ""
curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: 0e968e38-6fcb-3ab0-095d-d0d948befe91" -d '{
	"Type": "hello",
	"Args":["Edmonton Go!"]
}' ""
You can’t perform that action at this time.