diff --git a/cmd/alertmanager_matrix/alertmanager_matrix.go b/cmd/alertmanager_matrix/alertmanager_matrix.go
index aa1c40c..d07f550 100644
--- a/cmd/alertmanager_matrix/alertmanager_matrix.go
+++ b/cmd/alertmanager_matrix/alertmanager_matrix.go
@@ -50,7 +50,7 @@ func setStringFromEnv(target *string, env string) {
}
func loadFile(fileName string) string {
- contents, err := os.ReadFile(fileName) // nolint:gosec // contents inclusion is the point
+ contents, err := os.ReadFile(fileName) //nolint:gosec // contents inclusion is the point
if err != nil {
log.Fatalf("Unable to read file %q: %s", fileName, err)
}
@@ -59,7 +59,7 @@ func loadFile(fileName string) string {
}
func mapFromYAMLFile(fileName string) map[string]string {
- file, err := os.Open(fileName) // nolint:gosec // file inclusion is the point
+ file, err := os.Open(fileName) //nolint:gosec // file inclusion is the point
if err != nil {
log.Fatalf("Unable to open YAML file %q: %s", fileName, err)
}
diff --git a/pkg/bot/formatting.go b/pkg/bot/formatting.go
index 7cd24c5..9403fce 100644
--- a/pkg/bot/formatting.go
+++ b/pkg/bot/formatting.go
@@ -13,13 +13,13 @@ import (
// Default alert template values.
const (
- DefaultTextTemplate = "{{ range .Alerts }}{{.StatusString|icon}} {{.StatusString|upper}} {{.AlertName}}: {{.Summary}}{{if ne .Fingerprint \"\"}} ({{.Fingerprint}}){{end}}{{if $.ShowLabels}}, labels: {{.LabelString}}{{end}}\n{{ end -}}" // nolint:lll
- DefaultHTMLTemplate = `{{ range .Alerts }}{{.StatusString|icon}} {{.StatusString|upper}} {{.AlertName}}: {{.Summary}}{{if ne .Fingerprint ""}} ({{.Fingerprint}}){{end}}{{if $.ShowLabels}}
Labels: {{.LabelString}}
{{end}}
{{- end -}}` // nolint:lll
+ DefaultTextTemplate = "{{ range .Alerts }}{{.StatusString|icon}} {{.StatusString|upper}} {{.AlertName}}: {{.Summary}}{{if ne .Fingerprint \"\"}} ({{.Fingerprint}}){{end}}{{if $.ShowLabels}}, labels: {{.LabelString}}{{end}}\n{{ end -}}" //nolint:lll
+ DefaultHTMLTemplate = `{{ range .Alerts }}{{.StatusString|icon}} {{.StatusString|upper}} {{.AlertName}}: {{.Summary}}{{if ne .Fingerprint ""}} ({{.Fingerprint}}){{end}}{{if $.ShowLabels}}
Labels: {{.LabelString}}
{{end}}
{{- end -}}` //nolint:lll
)
// Default color and icon values.
var (
- DefaultColors = map[string]string{ // nolint:gochecknoglobals
+ DefaultColors = map[string]string{ //nolint:gochecknoglobals
"alert": "black",
"information": "blue",
"warning": "orange",
@@ -28,7 +28,7 @@ var (
"silenced": "gray",
}
- DefaultIcons = map[string]string{ // nolint:gochecknoglobals
+ DefaultIcons = map[string]string{ //nolint:gochecknoglobals
"alert": "đī¸",
"information": "âšī¸",
"warning": "â ī¸",
@@ -51,12 +51,11 @@ type Formatter struct {
//
// The following functions are registered for use in the templates:
//
-// icon: returns the icon for the given string.
-// color: returns the color for the given string.
-// upper: converts the given string to uppercase.
-// lower: converts the given string to lowercase.
-// title: converts the given string to title case.
-//
+// icon: returns the icon for the given string.
+// color: returns the color for the given string.
+// upper: converts the given string to uppercase.
+// lower: converts the given string to lowercase.
+// title: converts the given string to title case.
func NewFormatter(textTemplate, htmlTemplate string, colors, icons map[string]string) *Formatter {
if textTemplate == "" {
textTemplate = DefaultTextTemplate
diff --git a/pkg/bot/matrix.go b/pkg/bot/matrix.go
index b4455a2..6af4748 100644
--- a/pkg/bot/matrix.go
+++ b/pkg/bot/matrix.go
@@ -10,7 +10,6 @@ import (
"github.com/prometheus/alertmanager/pkg/labels"
"github.com/prometheus/alertmanager/types"
-
bot "gitlab.com/silkeh/matrix-bot"
"github.com/silkeh/alertmanager_matrix/pkg/alertmanager"