From 411d67c23195a4758c667a87a3827501a9623de2 Mon Sep 17 00:00:00 2001 From: rainzm Date: Fri, 19 Nov 2021 12:24:46 +0800 Subject: [PATCH] fix: adjust the initialization order of init function contents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 改之前,mod_notification.go的init执行在mod_notify.go之前,但是mod_notification.go init的初始化内容又依赖于mod_notify.go 所以现在合并一起 --- pkg/mcclient/modules/notify/mod_notification.go | 6 ------ pkg/mcclient/modules/notify/mod_notify.go | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/mcclient/modules/notify/mod_notification.go b/pkg/mcclient/modules/notify/mod_notification.go index a88c01fde4..ca48cdb52d 100644 --- a/pkg/mcclient/modules/notify/mod_notification.go +++ b/pkg/mcclient/modules/notify/mod_notification.go @@ -99,9 +99,3 @@ func (manager *NotificationManager) Send(s *mcclient.ClientSession, msg SNotifyM _, err := manager.Create(s, params) return err } - -func init() { - Notifications = NotificationManager{ - Notification, - } -} diff --git a/pkg/mcclient/modules/notify/mod_notify.go b/pkg/mcclient/modules/notify/mod_notify.go index 3d411bce22..17e353f7ee 100644 --- a/pkg/mcclient/modules/notify/mod_notify.go +++ b/pkg/mcclient/modules/notify/mod_notify.go @@ -90,4 +90,9 @@ func init() { []string{}, ) modules.Register(&NotifySubscriber) + + // important: Notifications' init must be behind Notication's init + Notifications = NotificationManager{ + Notification, + } }