From 417ddf1ccff7f11e520a80516a3c2e44e701eb96 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Mon, 25 Oct 2021 15:48:21 +0800 Subject: [PATCH] feat(plugins): add plugins --- plugins/mock-plugin/mock.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/plugins/mock-plugin/mock.go b/plugins/mock-plugin/mock.go index 0c87df2..07ad8e5 100644 --- a/plugins/mock-plugin/mock.go +++ b/plugins/mock-plugin/mock.go @@ -1,11 +1,27 @@ package mockplugin -import "fmt" +import ( + "fmt" + "net/http" + _ "net/http/pprof" + + _ "gitee.com/timedb/wheatCache/conf" + "gitee.com/timedb/wheatCache/pkg/logx" + "github.com/spf13/viper" +) type MockPlugin struct { } func (m *MockPlugin) Init() { + addr := viper.GetString("mock-plugin.pprof-addr") + if addr != "" { + go func() { + logx.Debugln(http.ListenAndServe(addr, nil)) + }() + } + + logx.Debug("mock-plugins status: start") } func (m *MockPlugin) Exec(msg interface{}) (interface{}, error) {