Make golint happier

This commit is contained in:
Julian Kornberger
2018-03-22 22:13:46 +01:00
parent 63465fd556
commit 0a415c50d0
44 changed files with 553 additions and 546 deletions

View File

@ -19,7 +19,7 @@ func GetPluginList(c *m.ReqContext) Response {
pluginSettingsMap, err := plugins.GetPluginSettings(c.OrgId)
if err != nil {
return ApiError(500, "Failed to get list of plugins", err)
return Error(500, "Failed to get list of plugins", err)
}
result := make(dtos.PluginList, 0)
@ -75,7 +75,7 @@ func GetPluginList(c *m.ReqContext) Response {
}
sort.Sort(result)
return Json(200, result)
return JSON(200, result)
}
func GetPluginSettingByID(c *m.ReqContext) Response {
@ -83,7 +83,7 @@ func GetPluginSettingByID(c *m.ReqContext) Response {
def, exists := plugins.Plugins[pluginID]
if !exists {
return ApiError(404, "Plugin not found, no installed plugin with that id", nil)
return Error(404, "Plugin not found, no installed plugin with that id", nil)
}
dto := &dtos.PluginSetting{
@ -104,7 +104,7 @@ func GetPluginSettingByID(c *m.ReqContext) Response {
query := m.GetPluginSettingByIdQuery{PluginId: pluginID, OrgId: c.OrgId}
if err := bus.Dispatch(&query); err != nil {
if err != m.ErrPluginSettingNotFound {
return ApiError(500, "Failed to get login settings", nil)
return Error(500, "Failed to get login settings", nil)
}
} else {
dto.Enabled = query.Result.Enabled
@ -112,7 +112,7 @@ func GetPluginSettingByID(c *m.ReqContext) Response {
dto.JsonData = query.Result.JsonData
}
return Json(200, dto)
return JSON(200, dto)
}
func UpdatePluginSetting(c *m.ReqContext, cmd m.UpdatePluginSettingCmd) Response {
@ -122,14 +122,14 @@ func UpdatePluginSetting(c *m.ReqContext, cmd m.UpdatePluginSettingCmd) Response
cmd.PluginId = pluginID
if _, ok := plugins.Apps[cmd.PluginId]; !ok {
return ApiError(404, "Plugin not installed.", nil)
return Error(404, "Plugin not installed.", nil)
}
if err := bus.Dispatch(&cmd); err != nil {
return ApiError(500, "Failed to update plugin setting", err)
return Error(500, "Failed to update plugin setting", err)
}
return ApiSuccess("Plugin settings updated")
return Success("Plugin settings updated")
}
func GetPluginDashboards(c *m.ReqContext) Response {
@ -138,13 +138,13 @@ func GetPluginDashboards(c *m.ReqContext) Response {
list, err := plugins.GetPluginDashboards(c.OrgId, pluginID)
if err != nil {
if notfound, ok := err.(plugins.PluginNotFoundError); ok {
return ApiError(404, notfound.Error(), nil)
return Error(404, notfound.Error(), nil)
}
return ApiError(500, "Failed to get plugin dashboards", err)
return Error(500, "Failed to get plugin dashboards", err)
}
return Json(200, list)
return JSON(200, list)
}
func GetPluginMarkdown(c *m.ReqContext) Response {
@ -154,10 +154,10 @@ func GetPluginMarkdown(c *m.ReqContext) Response {
content, err := plugins.GetPluginMarkdown(pluginID, name)
if err != nil {
if notfound, ok := err.(plugins.PluginNotFoundError); ok {
return ApiError(404, notfound.Error(), nil)
return Error(404, notfound.Error(), nil)
}
return ApiError(500, "Could not get markdown file", err)
return Error(500, "Could not get markdown file", err)
}
resp := Respond(200, content)
@ -178,8 +178,8 @@ func ImportDashboard(c *m.ReqContext, apiCmd dtos.ImportDashboardCommand) Respon
}
if err := bus.Dispatch(&cmd); err != nil {
return ApiError(500, "Failed to import dashboard", err)
return Error(500, "Failed to import dashboard", err)
}
return Json(200, cmd.Result)
return JSON(200, cmd.Result)
}