Skip to content

Commit ed451c5

Browse files
committed
Add Travis. Fix some goreport issues.
1 parent aa4c20e commit ed451c5

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: go
2+
go:
3+
- '1.9'
4+
5+
script:
6+
- go vet
7+
- gofmt -e -d *.go
8+
- go build

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ It has been initially created to post all questions related to the [API Platform
77
in a dedicated channel of the Slack of [Les-Tilleuls.coop](https://les-tilleuls.coop) (the company behind the framework).
88

99
[![Go Report Card](https://goreportcard.com/badge/github.com/dunglas/stack2slack)](https://goreportcard.com/report/github.com/dunglas/stack2slack)
10+
[![Build Status](https://travis-ci.org/dunglas/stack2slack.svg?branch=master)](https://travis-ci.org/dunglas/stack2slack)
1011

1112
## Installing
1213

stack2slack.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/nlopes/slack"
1313
)
1414

15-
const waitBetweenChecks = time.Minute * 5
15+
const waitBetweenChecks = time.Minute * 5
1616

1717
func main() {
1818
slackApiToken := os.Getenv("SLACK_API_TOKEN")
@@ -37,7 +37,7 @@ func main() {
3737
stackSite = "stackoverflow"
3838
}
3939

40-
runSlackClient(slackApiToken, stackSite, tagToChannelName, os.Getenv("DEBUG") == "1")
40+
runSlackClient(slackApiToken, stackSite, tagToChannelName, os.Getenv("DEBUG") == "1")
4141
}
4242

4343
func runSlackClient(slackApiToken string, stackSite string, tagToChannelName map[string]string, debug bool) {
@@ -59,7 +59,7 @@ func runSlackClient(slackApiToken string, stackSite string, tagToChannelName map
5959

6060
tagToChannelId := make(map[string]string, len(tagToChannelName))
6161

62-
OUTER:
62+
OUTER:
6363
for tagName, channelName := range tagToChannelName {
6464
for _, channel := range ev.Info.Channels {
6565
if channelName == channel.Name {
@@ -93,7 +93,7 @@ func watchStack(rtm *slack.RTM, tagToChannelId map[string]string, stackSite stri
9393
if lastCreationDate > 0 {
9494
url = fmt.Sprintf("%s&min=%d", baseUrl, lastCreationDate)
9595
} else {
96-
url= baseUrl
96+
url = baseUrl
9797
}
9898

9999
resp, err := http.Get(url)
@@ -109,15 +109,15 @@ func watchStack(rtm *slack.RTM, tagToChannelId map[string]string, stackSite stri
109109
}
110110

111111
type Item struct {
112-
Tags []string `json:tags`
113-
Owner Owner `json:owner`
112+
Tags []string `json:"tags"`
113+
Owner Owner `json:"owner"`
114114
CreationDate int `json:"creation_date"`
115-
Title string `json:title`
116-
Link string `json:link`
115+
Title string `json:"title"`
116+
Link string `json:"link"`
117117
}
118118

119119
type Response struct {
120-
Items []Item `json:items`
120+
Items []Item `json:"items"`
121121
}
122122

123123
var stackResponse = new(Response)

0 commit comments

Comments
 (0)