Last active
August 29, 2015 14:06
-
-
Save ctdk/5df969333bc4ed811708 to your computer and use it in GitHub Desktop.
A sample plugin for gosudar.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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