diff --git a/src/github.com/matrix-org/go-neb/realms/jira/jira.go b/src/github.com/matrix-org/go-neb/realms/jira/jira.go
index 41f5889..93c9328 100644
--- a/src/github.com/matrix-org/go-neb/realms/jira/jira.go
+++ b/src/github.com/matrix-org/go-neb/realms/jira/jira.go
@@ -165,7 +165,7 @@ func (r *Realm) Init() error {
// Register is called when this realm is being created from an external entity
func (r *Realm) Register() error {
if r.ConsumerName == "" || r.ConsumerKey == "" || r.ConsumerSecret == "" || r.PrivateKeyPEM == "" {
- return errors.New("ConsumerName, ConsumerKey, ConsumerSecret, PrivateKeyPEM must be specified.")
+ return errors.New("ConsumerName, ConsumerKey, ConsumerSecret, PrivateKeyPEM must be specified")
}
if r.JIRAEndpoint == "" {
return errors.New("JIRAEndpoint must be specified")
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 dde808f..54793a8 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
@@ -5,13 +5,14 @@ import (
"bytes"
"encoding/json"
"fmt"
+ html "html/template"
+ "net/http"
+ text "text/template"
+
log "github.com/Sirupsen/logrus"
"github.com/matrix-org/go-neb/database"
"github.com/matrix-org/go-neb/types"
"github.com/matrix-org/gomatrix"
- html "html/template"
- "net/http"
- text "text/template"
)
// ServiceType of the Alertmanager service.
@@ -52,7 +53,7 @@ type Service struct {
} `json:"rooms"`
}
-// The payload from Alertmanager
+// WebhookNotification is the payload from Alertmanager
type WebhookNotification struct {
Version string `json:"version"`
GroupKey string `json:"groupKey"`
@@ -61,14 +62,14 @@ type WebhookNotification struct {
GroupLabels map[string]string `json:"groupLabels"`
CommonLabels map[string]string `json:"commonLabels"`
CommonAnnotations map[string]string `json:"commonAnnotations"`
- ExternalUrl string `json:"externalURL"`
+ ExternalURL string `json:"externalURL"`
Alerts []struct {
Status string `json:"status"`
Labels map[string]string `json:"labels"`
Annotations map[string]string `json:"annotations"`
StartsAt string `json:"startsAt"`
EndsAt string `json:"endsAt"`
- GeneratorUrl string `json:"generatorURL"`
+ GeneratorURL string `json:"generatorURL"`
} `json:"alerts"`
}
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 ca3fc2f..eef9bab 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
@@ -12,6 +12,8 @@ import (
"strings"
"bytes"
+ "html"
+
log "github.com/Sirupsen/logrus"
gogithub "github.com/google/go-github/github"
"github.com/matrix-org/go-neb/database"
@@ -20,7 +22,6 @@ import (
"github.com/matrix-org/go-neb/services/github/client"
"github.com/matrix-org/go-neb/types"
"github.com/matrix-org/gomatrix"
- "html"
)
// ServiceType of the Github service
@@ -450,8 +451,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
}
@@ -460,9 +461,9 @@ func (s *Service) expandCommit(roomID, userID, owner, repo, sha string) interfac
var htmlBuffer bytes.Buffer
var plainBuffer bytes.Buffer
- shortUrl := strings.TrimSuffix(*c.HTMLURL, *c.SHA) + sha
- htmlBuffer.WriteString(fmt.Sprintf("%s
", *c.HTMLURL, shortUrl))
- plainBuffer.WriteString(fmt.Sprintf("%s\n", shortUrl))
+ shortURL := strings.TrimSuffix(*c.HTMLURL, *c.SHA) + sha
+ htmlBuffer.WriteString(fmt.Sprintf("%s
", *c.HTMLURL, shortURL))
+ plainBuffer.WriteString(fmt.Sprintf("%s\n", shortURL))
if c.Stats != nil {
htmlBuffer.WriteString(fmt.Sprintf("[~%d, +%d, -%d] ", len(c.Files), *c.Stats.Additions, *c.Stats.Deletions))
@@ -744,7 +745,7 @@ func getTokenForUser(realmID, userID string) (string, error) {
return "", fmt.Errorf("Session is not a github session: %s", session.ID())
}
if ghSession.AccessToken == "" {
- return "", fmt.Errorf("Github auth session for %s has not been completed.", userID)
+ return "", fmt.Errorf("Github auth session for %s has not been completed", userID)
}
return ghSession.AccessToken, nil
}
diff --git a/src/github.com/matrix-org/go-neb/services/github/github_webhook.go b/src/github.com/matrix-org/go-neb/services/github/github_webhook.go
index fdf36e6..ddbf1d3 100644
--- a/src/github.com/matrix-org/go-neb/services/github/github_webhook.go
+++ b/src/github.com/matrix-org/go-neb/services/github/github_webhook.go
@@ -156,7 +156,7 @@ func (s *WebhookService) Register(oldService types.Service, client *gomatrix.Cli
cli := s.githubClientFor(s.ClientUserID, false)
if cli == nil {
return fmt.Errorf(
- "User %s does not have a Github auth session with realm %s.", s.ClientUserID, realm.ID())
+ "User %s does not have a Github auth session with realm %s", s.ClientUserID, realm.ID())
}
// Fetch the old service list and work out the difference between the two services.
@@ -182,7 +182,7 @@ func (s *WebhookService) Register(oldService types.Service, client *gomatrix.Cli
// The user didn't specify any webhooks. This may be a bug or it may be
// a conscious decision to remove all webhooks for this service. Figure out
// which it is by checking if we'd be removing any webhooks.
- return fmt.Errorf("No webhooks specified.")
+ return fmt.Errorf("No webhooks specified")
}
for _, r := range newRepos {
logger := log.WithField("repo", r)
diff --git a/src/github.com/matrix-org/go-neb/services/jira/jira.go b/src/github.com/matrix-org/go-neb/services/jira/jira.go
index 647c9d9..8e15b05 100644
--- a/src/github.com/matrix-org/go-neb/services/jira/jira.go
+++ b/src/github.com/matrix-org/go-neb/services/jira/jira.go
@@ -101,7 +101,7 @@ func (s *Service) cmdJiraCreate(roomID, userID string, args []string) (interface
}
if !projectKeyRegex.MatchString(args[0]) {
- return nil, errors.New("Project key must only contain A-Z.")
+ return nil, errors.New("Project key must only contain A-Z")
}
pkey := strings.ToUpper(args[0]) // REST API complains if they are not ALL CAPS
@@ -118,10 +118,10 @@ func (s *Service) cmdJiraCreate(roomID, userID string, args []string) (interface
r, err := s.projectToRealm(userID, pkey)
if err != nil {
log.WithError(err).Print("Failed to map project key to realm")
- return nil, errors.New("Failed to map project key to a JIRA endpoint.")
+ return nil, errors.New("Failed to map project key to a JIRA endpoint")
}
if r == nil {
- return nil, errors.New("No known project exists with that project key.")
+ return nil, errors.New("No known project exists with that project key")
}
iss := gojira.Issue{
diff --git a/src/github.com/matrix-org/go-neb/services/jira/webhook/webhook.go b/src/github.com/matrix-org/go-neb/services/jira/webhook/webhook.go
index edc9417..c9738f7 100644
--- a/src/github.com/matrix-org/go-neb/services/jira/webhook/webhook.go
+++ b/src/github.com/matrix-org/go-neb/services/jira/webhook/webhook.go
@@ -85,7 +85,7 @@ func RegisterHook(jrealm *jira.Realm, projects []string, userID, webhookEndpoint
// JIRA endpoint.
if !jrealm.HasWebhook {
logger.Print("No webhook exists for this realm.")
- return fmt.Errorf("Not authorised to create webhook: not an admin.")
+ return fmt.Errorf("Not authorised to create webhook: not an admin")
}
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 2fae906..2d6a4cf 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
@@ -81,7 +81,7 @@ func (s *Service) Register(oldService types.Service, client *gomatrix.Client) er
numOldFeeds = len(oldFeedService.Feeds)
}
if numOldFeeds == 0 {
- return errors.New("An RSS feed must be specified.")
+ return errors.New("An RSS feed must be specified")
}
return nil
}
diff --git a/src/github.com/matrix-org/go-neb/services/travisci/travisci.go b/src/github.com/matrix-org/go-neb/services/travisci/travisci.go
index 936bd1b..486496c 100644
--- a/src/github.com/matrix-org/go-neb/services/travisci/travisci.go
+++ b/src/github.com/matrix-org/go-neb/services/travisci/travisci.go
@@ -247,7 +247,7 @@ func (s *Service) Register(oldService types.Service, client *gomatrix.Client) er
for repo := range roomData.Repos {
match := ownerRepoRegex.FindStringSubmatch(repo)
if len(match) == 0 {
- return fmt.Errorf("Repository '%s' is not a valid repository name.", repo)
+ return fmt.Errorf("Repository '%s' is not a valid repository name", repo)
}
}
}