OSDN Git Service

Merge pull request #201 from Bytom/v0.1
[bytom/vapor.git] / vendor / github.com / hashicorp / go-plugin / examples / basic / plugin / greeter_impl.go
diff --git a/vendor/github.com/hashicorp/go-plugin/examples/basic/plugin/greeter_impl.go b/vendor/github.com/hashicorp/go-plugin/examples/basic/plugin/greeter_impl.go
deleted file mode 100644 (file)
index d60c26c..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-package main
-
-import (
-       "os"
-
-       "github.com/hashicorp/go-hclog"
-       "github.com/hashicorp/go-plugin"
-       "github.com/hashicorp/go-plugin/examples/basic/commons"
-)
-
-// Here is a real implementation of Greeter
-type GreeterHello struct {
-       logger hclog.Logger
-}
-
-func (g *GreeterHello) Greet() string {
-       g.logger.Debug("message from GreeterHello.Greet")
-       return "Hello!"
-}
-
-// handshakeConfigs are used to just do a basic handshake between
-// a plugin and host. If the handshake fails, a user friendly error is shown.
-// This prevents users from executing bad plugins or executing a plugin
-// directory. It is a UX feature, not a security feature.
-var handshakeConfig = plugin.HandshakeConfig{
-       ProtocolVersion:  1,
-       MagicCookieKey:   "BASIC_PLUGIN",
-       MagicCookieValue: "hello",
-}
-
-func main() {
-       logger := hclog.New(&hclog.LoggerOptions{
-               Level:      hclog.Trace,
-               Output:     os.Stderr,
-               JSONFormat: true,
-       })
-
-       greeter := &GreeterHello{
-               logger: logger,
-       }
-       // pluginMap is the map of plugins we can dispense.
-       var pluginMap = map[string]plugin.Plugin{
-               "greeter": &example.GreeterPlugin{Impl: greeter},
-       }
-
-       logger.Debug("message from plugin", "foo", "bar")
-
-       plugin.Serve(&plugin.ServeConfig{
-               HandshakeConfig: handshakeConfig,
-               Plugins:         pluginMap,
-       })
-}