Move setting plugin helpers to a seperate function to avoid breaking changes. (#10809)

Этот коммит содержится в:
Christopher Speller
2019-05-08 11:54:52 -07:00
коммит произвёл Harrison Healey
родитель 6ce3cc6921
Коммит 66cb36f5dc
3 изменённых файлов: 15 добавлений и 6 удалений

Просмотреть файл

@@ -17,11 +17,13 @@ const (
// Call this when your plugin is ready to start.
func ClientMain(pluginImplementation interface{}) {
if impl, ok := pluginImplementation.(interface {
SetAPI(api API, helpers Helpers)
SetAPI(api API)
SetHelpers(helpers Helpers)
}); !ok {
panic("Plugin implementation given must embed plugin.MattermostPlugin")
} else {
impl.SetAPI(nil, nil)
impl.SetAPI(nil)
impl.SetHelpers(nil)
}
pluginMap := map[string]plugin.Plugin{
@@ -42,7 +44,11 @@ type MattermostPlugin struct {
// SetAPI persists the given API interface to the plugin. It is invoked just prior to the
// OnActivate hook, exposing the API for use by the plugin.
func (p *MattermostPlugin) SetAPI(api API, helpers Helpers) {
func (p *MattermostPlugin) SetAPI(api API) {
p.API = api
}
// SetHelpers does the same thing as SetAPI except for the plugin helpers.
func (p *MattermostPlugin) SetHelpers(helpers Helpers) {
p.Helpers = helpers
}