提交 e9aa0cee 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

plugin communication sample

上级 2125d96e
package zapShared
import (
zapPlugin "github.com/easysoft/zentaoatf/internal/pkg/plugin/zap/plugin"
"github.com/hashicorp/go-plugin"
)
......@@ -9,10 +8,6 @@ const (
PluginNameZap = "ZAP"
)
var PluginMap = map[string]plugin.Plugin{
PluginNameZap: &zapPlugin.ZapPlugin{},
}
// Handshake is a common handshake that is shared by plugin and host.
var Handshake = plugin.HandshakeConfig{
// This isn't required when using VersionedPlugins
......
......@@ -2,6 +2,7 @@ package service
import (
"fmt"
zapPlugin "github.com/easysoft/zentaoatf/internal/pkg/plugin/zap/plugin"
zapService "github.com/easysoft/zentaoatf/internal/pkg/plugin/zap/service"
"github.com/easysoft/zentaoatf/internal/pkg/plugin/zap/shared"
shellUtils "github.com/easysoft/zentaoatf/pkg/lib/shell"
......@@ -19,7 +20,9 @@ type PluginService struct {
func (s *PluginService) Start() (err error) {
s.zapClient = plugin.NewClient(&plugin.ClientConfig{
Plugins: zapShared.PluginMap,
Plugins: map[string]plugin.Plugin{
zapShared.PluginNameZap: &zapPlugin.ZapPlugin{},
},
Cmd: shellUtils.GetCmd(ZapPath),
HandshakeConfig: zapShared.Handshake,
AllowedProtocols: []plugin.Protocol{plugin.ProtocolNetRPC, plugin.ProtocolGRPC},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册