summaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorDaniel Schalla <daniel@schalla.me>2018-09-03 14:08:40 +0200
committerJesús Espino <jespinog@gmail.com>2018-09-03 14:08:40 +0200
commit531897b1f0d8176c1f983f921f1d1de618db0131 (patch)
tree0f01811eee640141b6a1959ed64a7b250fd59d47 /plugin
parent68fdaaa995555e93f067efc3a07f1866e43ae665 (diff)
downloadchat-531897b1f0d8176c1f983f921f1d1de618db0131.tar.gz
chat-531897b1f0d8176c1f983f921f1d1de618db0131.tar.bz2
chat-531897b1f0d8176c1f983f921f1d1de618db0131.zip
add megacheck as makefile target (#9288)
Fix code issues in channel_test.go Fix Channel Test Issues detected by Megacheck Fix API Emoji Test Issues detected by Megacheck Fixed API Issues Reported by Megacheck Fixed App issues reported by megacheck Remaining fixes removed test added by mistake from old HEAD gofmt Store Fixes simplified returns Fix test for multi member channel delete revert to delete unused function
Diffstat (limited to 'plugin')
-rw-r--r--plugin/client_rpc.go1
-rw-r--r--plugin/client_rpc_generated.go26
-rw-r--r--plugin/environment.go1
-rw-r--r--plugin/interface_generator/main.go4
-rw-r--r--plugin/io_rpc.go13
-rw-r--r--plugin/supervisor.go1
6 files changed, 15 insertions, 31 deletions
diff --git a/plugin/client_rpc.go b/plugin/client_rpc.go
index dde4c5f2e..986c2b50f 100644
--- a/plugin/client_rpc.go
+++ b/plugin/client_rpc.go
@@ -295,7 +295,6 @@ func (g *hooksRPCClient) ServeHTTP(c *Context, w http.ResponseWriter, r *http.Re
g.log.Error("Plugin failed to ServeHTTP, RPC call failed", mlog.Err(err))
http.Error(w, "500 internal server error", http.StatusInternalServerError)
}
- return
}
func (s *hooksRPCServer) ServeHTTP(args *Z_ServeHTTPArgs, returns *struct{}) error {
diff --git a/plugin/client_rpc_generated.go b/plugin/client_rpc_generated.go
index d0d576f8d..9cebda716 100644
--- a/plugin/client_rpc_generated.go
+++ b/plugin/client_rpc_generated.go
@@ -209,7 +209,7 @@ func (g *hooksRPCClient) MessageHasBeenPosted(c *Context, post *model.Post) {
g.log.Error("RPC call MessageHasBeenPosted to plugin failed.", mlog.Err(err))
}
}
- return
+
}
func (s *hooksRPCServer) MessageHasBeenPosted(args *Z_MessageHasBeenPostedArgs, returns *Z_MessageHasBeenPostedReturns) error {
@@ -244,7 +244,7 @@ func (g *hooksRPCClient) MessageHasBeenUpdated(c *Context, newPost, oldPost *mod
g.log.Error("RPC call MessageHasBeenUpdated to plugin failed.", mlog.Err(err))
}
}
- return
+
}
func (s *hooksRPCServer) MessageHasBeenUpdated(args *Z_MessageHasBeenUpdatedArgs, returns *Z_MessageHasBeenUpdatedReturns) error {
@@ -278,7 +278,7 @@ func (g *hooksRPCClient) ChannelHasBeenCreated(c *Context, channel *model.Channe
g.log.Error("RPC call ChannelHasBeenCreated to plugin failed.", mlog.Err(err))
}
}
- return
+
}
func (s *hooksRPCServer) ChannelHasBeenCreated(args *Z_ChannelHasBeenCreatedArgs, returns *Z_ChannelHasBeenCreatedReturns) error {
@@ -313,7 +313,7 @@ func (g *hooksRPCClient) UserHasJoinedChannel(c *Context, channelMember *model.C
g.log.Error("RPC call UserHasJoinedChannel to plugin failed.", mlog.Err(err))
}
}
- return
+
}
func (s *hooksRPCServer) UserHasJoinedChannel(args *Z_UserHasJoinedChannelArgs, returns *Z_UserHasJoinedChannelReturns) error {
@@ -348,7 +348,7 @@ func (g *hooksRPCClient) UserHasLeftChannel(c *Context, channelMember *model.Cha
g.log.Error("RPC call UserHasLeftChannel to plugin failed.", mlog.Err(err))
}
}
- return
+
}
func (s *hooksRPCServer) UserHasLeftChannel(args *Z_UserHasLeftChannelArgs, returns *Z_UserHasLeftChannelReturns) error {
@@ -383,7 +383,7 @@ func (g *hooksRPCClient) UserHasJoinedTeam(c *Context, teamMember *model.TeamMem
g.log.Error("RPC call UserHasJoinedTeam to plugin failed.", mlog.Err(err))
}
}
- return
+
}
func (s *hooksRPCServer) UserHasJoinedTeam(args *Z_UserHasJoinedTeamArgs, returns *Z_UserHasJoinedTeamReturns) error {
@@ -418,7 +418,7 @@ func (g *hooksRPCClient) UserHasLeftTeam(c *Context, teamMember *model.TeamMembe
g.log.Error("RPC call UserHasLeftTeam to plugin failed.", mlog.Err(err))
}
}
- return
+
}
func (s *hooksRPCServer) UserHasLeftTeam(args *Z_UserHasLeftTeamArgs, returns *Z_UserHasLeftTeamReturns) error {
@@ -487,7 +487,7 @@ func (g *hooksRPCClient) UserHasLoggedIn(c *Context, user *model.User) {
g.log.Error("RPC call UserHasLoggedIn to plugin failed.", mlog.Err(err))
}
}
- return
+
}
func (s *hooksRPCServer) UserHasLoggedIn(args *Z_UserHasLoggedInArgs, returns *Z_UserHasLoggedInReturns) error {
@@ -2125,7 +2125,7 @@ func (g *apiRPCClient) PublishWebSocketEvent(event string, payload map[string]in
if err := g.client.Call("Plugin.PublishWebSocketEvent", _args, _returns); err != nil {
log.Printf("RPC call to PublishWebSocketEvent API failed: %s", err.Error())
}
- return
+
}
func (s *apiRPCServer) PublishWebSocketEvent(args *Z_PublishWebSocketEventArgs, returns *Z_PublishWebSocketEventReturns) error {
@@ -2242,7 +2242,7 @@ func (g *apiRPCClient) LogDebug(msg string, keyValuePairs ...interface{}) {
if err := g.client.Call("Plugin.LogDebug", _args, _returns); err != nil {
log.Printf("RPC call to LogDebug API failed: %s", err.Error())
}
- return
+
}
func (s *apiRPCServer) LogDebug(args *Z_LogDebugArgs, returns *Z_LogDebugReturns) error {
@@ -2270,7 +2270,7 @@ func (g *apiRPCClient) LogInfo(msg string, keyValuePairs ...interface{}) {
if err := g.client.Call("Plugin.LogInfo", _args, _returns); err != nil {
log.Printf("RPC call to LogInfo API failed: %s", err.Error())
}
- return
+
}
func (s *apiRPCServer) LogInfo(args *Z_LogInfoArgs, returns *Z_LogInfoReturns) error {
@@ -2298,7 +2298,7 @@ func (g *apiRPCClient) LogError(msg string, keyValuePairs ...interface{}) {
if err := g.client.Call("Plugin.LogError", _args, _returns); err != nil {
log.Printf("RPC call to LogError API failed: %s", err.Error())
}
- return
+
}
func (s *apiRPCServer) LogError(args *Z_LogErrorArgs, returns *Z_LogErrorReturns) error {
@@ -2326,7 +2326,7 @@ func (g *apiRPCClient) LogWarn(msg string, keyValuePairs ...interface{}) {
if err := g.client.Call("Plugin.LogWarn", _args, _returns); err != nil {
log.Printf("RPC call to LogWarn API failed: %s", err.Error())
}
- return
+
}
func (s *apiRPCServer) LogWarn(args *Z_LogWarnArgs, returns *Z_LogWarnReturns) error {
diff --git a/plugin/environment.go b/plugin/environment.go
index 5c3a98349..55543e239 100644
--- a/plugin/environment.go
+++ b/plugin/environment.go
@@ -18,7 +18,6 @@ import (
)
type apiImplCreatorFunc func(*model.Manifest) API
-type supervisorCreatorFunc func(*model.BundleInfo, *mlog.Logger, API) (*supervisor, error)
// multiPluginHookRunnerFunc is a callback function to invoke as part of RunMultiPluginHook.
//
diff --git a/plugin/interface_generator/main.go b/plugin/interface_generator/main.go
index b321c344a..6aa8bdfb1 100644
--- a/plugin/interface_generator/main.go
+++ b/plugin/interface_generator/main.go
@@ -229,7 +229,7 @@ func (g *hooksRPCClient) {{.Name}}{{funcStyle .Params}} {{funcStyle .Return}} {
g.log.Error("RPC call {{.Name}} to plugin failed.", mlog.Err(err))
}
}
- return {{destruct "_returns." .Return}}
+ {{ if .Return }} return {{destruct "_returns." .Return}} {{ end }}
}
func (s *hooksRPCServer) {{.Name}}(args *{{.Name | obscure}}Args, returns *{{.Name | obscure}}Returns) error {
@@ -260,7 +260,7 @@ func (g *apiRPCClient) {{.Name}}{{funcStyle .Params}} {{funcStyle .Return}} {
if err := g.client.Call("Plugin.{{.Name}}", _args, _returns); err != nil {
log.Printf("RPC call to {{.Name}} API failed: %s", err.Error())
}
- return {{destruct "_returns." .Return}}
+ {{ if .Return }} return {{destruct "_returns." .Return}} {{ end }}
}
func (s *apiRPCServer) {{.Name}}(args *{{.Name | obscure}}Args, returns *{{.Name | obscure}}Returns) error {
diff --git a/plugin/io_rpc.go b/plugin/io_rpc.go
index 18a1eb525..fad7373a1 100644
--- a/plugin/io_rpc.go
+++ b/plugin/io_rpc.go
@@ -9,19 +9,6 @@ import (
"io"
)
-type rwc struct {
- io.ReadCloser
- io.WriteCloser
-}
-
-func (rwc *rwc) Close() (err error) {
- err = rwc.WriteCloser.Close()
- if rerr := rwc.ReadCloser.Close(); err == nil {
- err = rerr
- }
- return
-}
-
type remoteIOReader struct {
conn io.ReadWriteCloser
}
diff --git a/plugin/supervisor.go b/plugin/supervisor.go
index 33243e9cf..1165f5fb3 100644
--- a/plugin/supervisor.go
+++ b/plugin/supervisor.go
@@ -17,7 +17,6 @@ import (
)
type supervisor struct {
- pluginId string
client *plugin.Client
hooks Hooks
implemented [TotalHooksId]bool