From 1d105b353dd46b6383dddbae081813a90a46ac81 Mon Sep 17 00:00:00 2001 From: UndeadDemidov <45305584+UndeadDemidov@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:45:05 +0300 Subject: [PATCH] lint fixes Signed-off-by: UndeadDemidov <45305584+UndeadDemidov@users.noreply.github.com> --- config/receiver/receiver.go | 2 +- notify/mattermost/mattermost.go | 16 +++++++++++++++- notify/mattermost/mattermost_test.go | 20 +++++++++++++++++--- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/config/receiver/receiver.go b/config/receiver/receiver.go index 828161b3..a3361ef8 100644 --- a/config/receiver/receiver.go +++ b/config/receiver/receiver.go @@ -105,7 +105,7 @@ func BuildReceiverIntegrations(nc config.Receiver, tmpl *template.Template, logg for i, c := range nc.RocketchatConfigs { add("rocketchat", i, c, func(l log.Logger) (notify.Notifier, error) { return rocketchat.New(c, tmpl, l, httpOpts...) }) } - for i,c:= range nc.MattermostConfigs { + for i, c := range nc.MattermostConfigs { add("mattermost", i, c, func(l log.Logger) (notify.Notifier, error) { return mattermost.New(c, tmpl, l, httpOpts...) }) } diff --git a/notify/mattermost/mattermost.go b/notify/mattermost/mattermost.go index ccc39eba..66f6a8d4 100644 --- a/notify/mattermost/mattermost.go +++ b/notify/mattermost/mattermost.go @@ -1,3 +1,16 @@ +// Copyright 2019 Prometheus Team +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mattermost import ( @@ -13,11 +26,12 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + commoncfg "github.com/prometheus/common/config" + "github.com/prometheus/alertmanager/config" "github.com/prometheus/alertmanager/notify" "github.com/prometheus/alertmanager/template" "github.com/prometheus/alertmanager/types" - commoncfg "github.com/prometheus/common/config" ) // Mattermost supports 16383 chars max. diff --git a/notify/mattermost/mattermost_test.go b/notify/mattermost/mattermost_test.go index b02328b1..0ee6dd6f 100644 --- a/notify/mattermost/mattermost_test.go +++ b/notify/mattermost/mattermost_test.go @@ -1,3 +1,16 @@ +// Copyright 2019 Prometheus Team +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mattermost import ( @@ -13,13 +26,14 @@ import ( "time" "github.com/go-kit/log" + commoncfg "github.com/prometheus/common/config" + "github.com/prometheus/common/model" + "github.com/stretchr/testify/require" + "github.com/prometheus/alertmanager/config" "github.com/prometheus/alertmanager/notify" "github.com/prometheus/alertmanager/notify/test" "github.com/prometheus/alertmanager/types" - commoncfg "github.com/prometheus/common/config" - "github.com/prometheus/common/model" - "github.com/stretchr/testify/require" ) var testWebhookURL, _ = url.Parse("https://mattermost.example.com/hooks/xxxxxxxxxxxxxxxxxxxxxxxxxx")