diff --git a/src/github.com/matrix-org/go-neb/services/alertmanager/alertmanager.go b/src/github.com/matrix-org/go-neb/services/alertmanager/alertmanager.go
index 64d74c2..ee8325e 100644
--- a/src/github.com/matrix-org/go-neb/services/alertmanager/alertmanager.go
+++ b/src/github.com/matrix-org/go-neb/services/alertmanager/alertmanager.go
@@ -11,8 +11,8 @@ import (
"github.com/matrix-org/gomatrix"
html "html/template"
"net/http"
- text "text/template"
"strings"
+ text "text/template"
)
// ServiceType of the Alertmanager service.
@@ -93,7 +93,7 @@ func (s *Service) OnReceiveWebhook(w http.ResponseWriter, req *http.Request, cli
for label, val := range alert.Labels {
filters = append(filters, fmt.Sprintf("%s%%3D\"%s\"", label, val))
}
- alert.SilenceURL = fmt.Sprintf("%s#silences/new?filter={%s}", notif.ExternalURL, strings.Join(filters, ",") )
+ alert.SilenceURL = fmt.Sprintf("%s#silences/new?filter={%s}", notif.ExternalURL, strings.Join(filters, ","))
}
for roomID, templates := range s.Rooms {
diff --git a/src/github.com/matrix-org/go-neb/services/alertmanager/alertmanager_test.go b/src/github.com/matrix-org/go-neb/services/alertmanager/alertmanager_test.go
index b8ca7f3..13c57c5 100644
--- a/src/github.com/matrix-org/go-neb/services/alertmanager/alertmanager_test.go
+++ b/src/github.com/matrix-org/go-neb/services/alertmanager/alertmanager_test.go
@@ -1,19 +1,19 @@
package alertmanager
import (
+ "bytes"
+ "encoding/json"
+ "fmt"
"github.com/matrix-org/go-neb/database"
"github.com/matrix-org/go-neb/testutils"
+ "github.com/matrix-org/go-neb/types"
"github.com/matrix-org/gomatrix"
- "net/http"
- "strings"
- "fmt"
- "encoding/json"
"io/ioutil"
- "bytes"
- "testing"
- "github.com/matrix-org/go-neb/types"
+ "net/http"
"net/http/httptest"
"regexp"
+ "strings"
+ "testing"
)
func TestNotify(t *testing.T) {
@@ -40,31 +40,31 @@ func TestNotify(t *testing.T) {
matrixCli.Client = &http.Client{Transport: matrixTrans}
// create the service
- html_template, err := json.Marshal(
+ htmlTemplate, err := json.Marshal(
`{{range .Alerts}}
{{index .Labels "severity" }} : {{- index .Labels "alertname" -}}
source
silence
{{- end }}
`,
- )
+ )
if err != nil {
t.Fatal(err)
}
- text_template, err := json.Marshal(`{{range .Alerts}}{{index .Labels "alertname"}} {{end}}`)
+ textTemplate, err := json.Marshal(`{{range .Alerts}}{{index .Labels "alertname"}} {{end}}`)
if err != nil {
t.Fatal(err)
}
- config := fmt.Sprintf(`{
+ config := fmt.Sprintf(`{
"rooms":{ "!testroom:id" : {
"text_template":%s,
"html_template":%s,
"msg_type":"m.text"
}}
- }`, text_template, html_template,
+ }`, textTemplate, htmlTemplate,
)
srv, err := types.CreateService("id", "alertmanager", "@neb:hs", []byte(config))
@@ -114,17 +114,17 @@ func TestNotify(t *testing.T) {
t.Errorf("Wrong msgtype: got %s want m.text", msg.MsgType)
}
- lines := strings.Split(msg.FormattedBody, "\n" )
+ lines := strings.Split(msg.FormattedBody, "\n")
// silence
silenceRegexp := regexp.MustCompile(`silence`)
matchedSilence := 0
for _, line := range lines {
- if ! strings.Contains(line, "silence") {
+ if !strings.Contains(line, "silence") {
continue
}
- matchedSilence += 1
+ matchedSilence++
m := silenceRegexp.FindStringSubmatch(line)
if m == nil {
t.Errorf("silence line %s had bad format", line)
diff --git a/src/github.com/matrix-org/go-neb/services/github/github.go b/src/github.com/matrix-org/go-neb/services/github/github.go
index cb867fb..914f628 100644
--- a/src/github.com/matrix-org/go-neb/services/github/github.go
+++ b/src/github.com/matrix-org/go-neb/services/github/github.go
@@ -450,8 +450,8 @@ func (s *Service) expandCommit(roomID, userID, owner, repo, sha string) interfac
if err != nil {
log.WithError(err).WithFields(log.Fields{
"owner": owner,
- "repo": repo,
- "sha": sha,
+ "repo": repo,
+ "sha": sha,
}).Print("Failed to fetch commit")
return nil
}
diff --git a/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go b/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go
index 34be9b3..6aa953f 100644
--- a/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go
+++ b/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go
@@ -353,13 +353,13 @@ func itemToHTML(feed *gofeed.Feed, item gofeed.Item) gomatrix.HTMLMessage {
Body: fmt.Sprintf("%s: %s ( %s )",
html.EscapeString(feed.Title), html.EscapeString(item.Title), html.EscapeString(item.Link)),
MsgType: "m.notice",
- Format: "org.matrix.custom.html",
+ Format: "org.matrix.custom.html",
FormattedBody: fmt.Sprintf("%s:
%s",
html.EscapeString(feed.Title), html.EscapeString(item.Link), html.EscapeString(item.Title)),
- // FeedTitle:
- //
- // Title of the Entry
- }
+ // FeedTitle:
+ //
+ // Title of the Entry
+ }
}
func ensureItemsHaveGUIDs(feed *gofeed.Feed) {