Skip to content

Instantly share code, notes, and snippets.

@ctdk
Last active August 29, 2015 14:06
Show Gist options
  • Save ctdk/5df969333bc4ed811708 to your computer and use it in GitHub Desktop.
Save ctdk/5df969333bc4ed811708 to your computer and use it in GitHub Desktop.
A sample plugin for gosudar.
package main
// A demonstration of a gosudar plugin. For now, place the compiled binary in /tmp/plugins.
import (
"net"
"net/rpc/jsonrpc"
"os"
)
func main() {
conn, err := net.Dial("unix", "/tmp/gosudar.sock")
if err != nil {
panic(err)
}
defer conn.Close()
values := make(map[string]interface{})
values["zzz"] = "zuz"
var reply string
c := jsonrpc.NewClient(conn)
err = c.Call("Info.SendInfo", values, &reply)
if err != nil {
panic(err)
}
os.Exit(0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment