* fixed: `identifier` is unused lint error

* make saveMultipleMembersT method saveMultipleMembers

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Mahmudul Haque
2021-02-04 11:38:05 +06:00
коммит произвёл GitHub
родитель 78ccf8a775
Коммит a63dea6c55
62 изменённых файлов: 257 добавлений и 245 удалений

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

@@ -13,7 +13,7 @@ type Plugin struct {
plugin.MattermostPlugin
}
func (p *Plugin) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request) {
func (p *Plugin) ServeHTTP(_ *plugin.Context, w http.ResponseWriter, _ *http.Request) {
hj, ok := w.(http.Hijacker)
if !ok {
w.WriteHeader(http.StatusInternalServerError)

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

@@ -17,7 +17,7 @@ type Plugin struct {
plugin.MattermostPlugin
}
func (p *Plugin) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request) {
func (p *Plugin) ServeHTTP(_ *plugin.Context, w http.ResponseWriter, r *http.Request) {
upgrader := websocket.Upgrader{}
ws, err := upgrader.Upgrade(w, r, nil)

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

@@ -30,7 +30,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
if p.configuration.MyStringSetting != "override" {
return nil, "MyStringSetting has invalid value"
}

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

@@ -33,7 +33,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
if p.configuration.MyStringSetting != "str" {
return nil, "MyStringSetting has invalid value"
}

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

@@ -21,7 +21,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
createdBot, err := p.API.CreateBot(&model.Bot{
Username: "bot",
Description: "a plugin bot",

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

@@ -22,7 +22,7 @@ func main() {
plugin.ClientMain(&PluginUsingLogAPI{})
}
func (p *PluginUsingLogAPI) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *PluginUsingLogAPI) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
p.API.LogDebug("LogDebug", "one", 1, "two", "two", "foo", Foo{bar: 3.1416})
p.API.LogInfo("LogInfo", "one", 1, "two", "two", "foo", Foo{bar: 3.1416})
p.API.LogWarn("LogWarn", "one", 1, "two", "two", "foo", Foo{bar: 3.1416})

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

@@ -24,7 +24,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
bundlePath, err := p.API.GetBundlePath()
if err != nil {
return nil, err.Error() + "failed get bundle path"

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

@@ -21,7 +21,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
channels, err := p.API.GetChannelsForTeamForUser(p.configuration.BasicTeamId, p.configuration.BasicUserId, false)
if err != nil {

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

@@ -21,7 +21,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
dm1, err := p.API.GetDirectChannel(p.configuration.BasicUserId, p.configuration.BasicUser2Id)
if err != nil {
return nil, err.Error()

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

@@ -21,7 +21,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
status, err := p.API.GetPluginStatus("test_get_plugin_status_plugin")
if err != nil {
return nil, err.Error()

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

@@ -21,7 +21,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
// check existing user first
data, err := p.API.GetProfileImage(p.configuration.BasicUserId)

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

@@ -21,7 +21,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
channelMembers, err := p.API.GetChannelMembersForUser(p.configuration.BasicTeamId, p.configuration.BasicUserId, 0, 10)
if err != nil {

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

@@ -21,7 +21,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
teamMembers, err := p.API.GetTeamMembersForUser(p.configuration.BasicUserId, 0, 10)
if err != nil {
return nil, err.Error() + "failed to get team members"

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

@@ -21,7 +21,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
channels, err := p.API.SearchChannels(p.configuration.BasicTeamId, p.configuration.BasicChannelName)
if err != nil {

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

@@ -23,7 +23,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
testCases := []struct {
description string
teamID string

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

@@ -23,7 +23,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
teams, err := p.API.SearchTeams(p.configuration.BasicTeamName)
if err != nil {
return nil, "search failed: " + err.Message

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

@@ -25,7 +25,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
to := p.configuration.BasicUserEmail
subject := "testing plugin api sending email"
body := "this is a test."

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

@@ -27,7 +27,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
// Create an 128 x 128 image
img := image.NewRGBA(image.Rect(0, 0, 128, 128))

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

@@ -21,7 +21,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
uid := p.configuration.BasicUserId
if err := p.API.UpdateUserActive(uid, true); err != nil {
return nil, err.Error()

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

@@ -23,7 +23,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
return nil
}
func (p *MyPlugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
uid := p.configuration.BasicUserId
statuses := []string{model.STATUS_ONLINE, model.STATUS_AWAY, model.STATUS_DND, model.STATUS_OFFLINE}