diff --git a/server/.golangci.yml b/server/.golangci.yml index 8b4dfec6d7..0863df0541 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -120,7 +120,6 @@ issues: channels/app/platform/web_conn.go|\ channels/app/platform/web_hub.go|\ channels/app/platform/web_hub_test.go|\ - channels/app/plugin_api_tests/manual.test_serve_metrics_plugin/main.go|\ channels/app/plugin_api_tests/test_update_user_auth_plugin/main.go|\ channels/app/plugin_install.go|\ channels/app/plugin_signature.go|\ diff --git a/server/channels/app/plugin_api_tests/manual.test_serve_metrics_plugin/main.go b/server/channels/app/plugin_api_tests/manual.test_serve_metrics_plugin/main.go index f2afa8f8cf..a15baa3a72 100644 --- a/server/channels/app/plugin_api_tests/manual.test_serve_metrics_plugin/main.go +++ b/server/channels/app/plugin_api_tests/manual.test_serve_metrics_plugin/main.go @@ -7,6 +7,7 @@ import ( "net/http" "github.com/mattermost/mattermost/server/public/plugin" + "github.com/mattermost/mattermost/server/public/shared/mlog" ) type Plugin struct { @@ -15,11 +16,21 @@ type Plugin struct { func (p *Plugin) ServeMetrics(_ *plugin.Context, w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/subpath" { - w.Write([]byte("METRICS SUBPATH")) + _, err := w.Write([]byte("METRICS SUBPATH")) + if err != nil { + mlog.Error("Failed to write response", mlog.Err(err)) + w.WriteHeader(http.StatusInternalServerError) + return + } return } - w.Write([]byte("METRICS")) + _, err := w.Write([]byte("METRICS")) + if err != nil { + mlog.Error("Failed to write response", mlog.Err(err)) + w.WriteHeader(http.StatusInternalServerError) + return + } } func main() {