Skip to content

Commit bcddaa3

Browse files
committed
chore: update dependencies and config.
1 parent d83dfc6 commit bcddaa3

File tree

8 files changed

+70
-50
lines changed

8 files changed

+70
-50
lines changed

.golangci.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,21 @@
2929
"lll",
3030
"gas",
3131
"dupl",
32+
"gomnd",
33+
"wsl",
3234
"prealloc",
3335
"scopelint",
36+
"goerr113",
37+
"testpackage",
3438
]
3539

3640
[issues]
3741
exclude-use-default = false
3842
max-per-linter = 0
3943
max-same-issues = 0
40-
exclude = []
44+
exclude = [
45+
"ST1000: at least one file in a package should have a package comment"
46+
]
4147
[[issues.exclude-rules]]
4248
path = "version.go"
4349
text = "`(version|date|commit)` is a global variable"

.travis.yml

+21-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
11
language: go
22

3-
go:
4-
- 1.11.x
5-
- 1.x
6-
7-
sudo: false
8-
93
notifications:
104
email:
115
on_success: never
126
on_failure: change
137

8+
cache:
9+
directories:
10+
- $GOPATH/pkg/mod
11+
12+
jobs:
13+
fast_finish: true
14+
include:
15+
- go: 1.14.x
16+
env: STABLE=true
17+
- go: 1.x
18+
- go: tip
19+
allow_failures:
20+
- go: tip
21+
1422
env:
15-
- GO111MODULE=on
23+
global:
24+
- GO111MODULE=on
1625

1726
before_install:
1827
# Install linters and misspell
19-
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.17.1
28+
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin ${GOLANGCI_LINT_VERSION}
2029
- golangci-lint --version
2130

2231
install:
32+
- go mod tidy
33+
- git diff --exit-code go.mod
34+
- git diff --exit-code go.sum
2335
- go mod download
2436

2537
deploy:
@@ -28,4 +40,4 @@ deploy:
2840
script: curl -sL https://git.io/goreleaser | bash
2941
on:
3042
tags: true
31-
condition: $TRAVIS_GO_VERSION =~ ^1\.x$
43+
condition: $STABLE = true

core/core.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"text/template"
88

99
"github.com/containous/kutteri/filter"
10-
"github.com/google/go-github/v27/github"
10+
"github.com/google/go-github/v32/github"
1111
"github.com/nlopes/slack"
1212
"golang.org/x/oauth2"
1313
)
@@ -20,7 +20,7 @@ type SlackConfig struct {
2020
DryRun bool
2121
}
2222

23-
// SearchCriterion GitHub search criterion
23+
// SearchCriterion GitHub search criterion.
2424
type SearchCriterion struct {
2525
Owner string
2626
RepoName string
@@ -29,18 +29,18 @@ type SearchCriterion struct {
2929
}
3030

3131
type messageModel struct {
32-
Issues []github.Issue
32+
Issues []*github.Issue
3333
Title string
3434
}
3535

36-
// Bot The Bot
36+
// Bot The Bot.
3737
type Bot struct {
3838
ghClient *github.Client
3939
slackClient *slack.Client
4040
SlackConfig SlackConfig
4141
}
4242

43-
// NewBot Create a new Bot
43+
// NewBot Create a new Bot.
4444
func NewBot(ctx context.Context, ghToken string, slackToken string, slackConfig SlackConfig) *Bot {
4545
return &Bot{
4646
ghClient: NewGitHubClient(ctx, ghToken),
@@ -49,7 +49,7 @@ func NewBot(ctx context.Context, ghToken string, slackToken string, slackConfig
4949
}
5050
}
5151

52-
// ProcessAll Execute bot on issues and pull request
52+
// ProcessAll Execute bot on issues and pull request.
5353
func (b *Bot) ProcessAll(ctx context.Context, searchConfig SearchCriterion) error {
5454
err := b.ProcessIssues(ctx, searchConfig)
5555
if err != nil {
@@ -59,7 +59,7 @@ func (b *Bot) ProcessAll(ctx context.Context, searchConfig SearchCriterion) erro
5959
return b.ProcessPullRequest(ctx, searchConfig)
6060
}
6161

62-
// ProcessIssues Execute bot on issues
62+
// ProcessIssues Execute bot on issues.
6363
func (b *Bot) ProcessIssues(ctx context.Context, searchConfig SearchCriterion) error {
6464
var models []messageModel
6565

@@ -105,7 +105,7 @@ func (b *Bot) ProcessIssues(ctx context.Context, searchConfig SearchCriterion) e
105105
return nil
106106
}
107107

108-
// ProcessPullRequest Execute bot on pull request
108+
// ProcessPullRequest Execute bot on pull request.
109109
func (b *Bot) ProcessPullRequest(ctx context.Context, searchConfig SearchCriterion) error {
110110
var models []messageModel
111111

@@ -167,13 +167,13 @@ func (b *Bot) ProcessPullRequest(ctx context.Context, searchConfig SearchCriteri
167167
return nil
168168
}
169169

170-
func searchUpdated(ctx context.Context, client *github.Client, query string, newIssues []github.Issue) ([]github.Issue, error) {
170+
func searchUpdated(ctx context.Context, client *github.Client, query string, newIssues []*github.Issue) ([]*github.Issue, error) {
171171
issues, err := search(ctx, client, query)
172172
if err != nil {
173173
return nil, err
174174
}
175175

176-
var realIssues []github.Issue
176+
var realIssues []*github.Issue
177177
for _, issue := range issues {
178178
var freshIssue bool
179179
for _, newIssue := range newIssues {
@@ -190,7 +190,7 @@ func searchUpdated(ctx context.Context, client *github.Client, query string, new
190190
return realIssues, nil
191191
}
192192

193-
func search(ctx context.Context, client *github.Client, query string) ([]github.Issue, error) {
193+
func search(ctx context.Context, client *github.Client, query string) ([]*github.Issue, error) {
194194
options := &github.SearchOptions{
195195
Sort: "updated",
196196
Order: "desc",
@@ -251,7 +251,7 @@ func sendToSlack(client *slack.Client, config SlackConfig, text string) error {
251251
return err
252252
}
253253

254-
// NewGitHubClient create a new GitHub client
254+
// NewGitHubClient create a new GitHub client.
255255
func NewGitHubClient(ctx context.Context, token string) *github.Client {
256256
if len(token) == 0 {
257257
return github.NewClient(nil)

filter/filter.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"log"
66
)
77

8-
// Build a filter
8+
// Build a filter.
99
func Build(fns ...func() string) string {
1010
var query string
1111
for _, fn := range fns {
@@ -15,62 +15,62 @@ func Build(fns ...func() string) string {
1515
return query
1616
}
1717

18-
// Issue type:issue
18+
// Issue type:issue.
1919
func Issue() string {
2020
return "type:issue"
2121
}
2222

23-
// PullRequest type:pr
23+
// PullRequest type:pr.
2424
func PullRequest() string {
2525
return "type:pr"
2626
}
2727

28-
// Open state:open
28+
// Open state:open.
2929
func Open() string {
3030
return "state:open"
3131
}
3232

33-
// InTitle in:title
33+
// InTitle in:title.
3434
func InTitle() string {
3535
return "in:title"
3636
}
3737

38-
// Content simple words
38+
// Content simple words.
3939
func Content(data string) func() string {
4040
return func() string {
4141
return data
4242
}
4343
}
4444

45-
// CreatedAfter created:>xxx
45+
// CreatedAfter created:>xxx.
4646
func CreatedAfter(date string) func() string {
4747
return func() string {
4848
return fmt.Sprintf("created:>%s", date)
4949
}
5050
}
5151

52-
// UpdatedAfter updated:>xxx
52+
// UpdatedAfter updated:>xxx.
5353
func UpdatedAfter(date string) func() string {
5454
return func() string {
5555
return fmt.Sprintf("updated:>%s", date)
5656
}
5757
}
5858

59-
// MergedAfter merged:>xxx
59+
// MergedAfter merged:>xxx.
6060
func MergedAfter(date string) func() string {
6161
return func() string {
6262
return fmt.Sprintf("merged:>%s", date)
6363
}
6464
}
6565

66-
// ClosedAfter closed:>xxx
66+
// ClosedAfter closed:>xxx.
6767
func ClosedAfter(date string) func() string {
6868
return func() string {
6969
return fmt.Sprintf("closed:>%s", date)
7070
}
7171
}
7272

73-
// Repo repo:xxx/yyy
73+
// Repo repo:xxx/yyy.
7474
func Repo(owner, repoName string) func() string {
7575
return func() string {
7676
return fmt.Sprintf("repo:%s/%s", owner, repoName)

go.mod

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
module github.com/containous/kutteri
22

3-
go 1.12
3+
go 1.14
44

55
require (
66
github.com/containous/flaeg v1.1.2
7-
github.com/davecgh/go-spew v1.1.0 // indirect
8-
github.com/google/go-github/v27 v27.0.4
7+
github.com/google/go-github/v32 v32.0.0
98
github.com/gorilla/websocket v1.2.0 // indirect
109
github.com/lusis/go-slackbot v0.0.0-20180109053408-401027ccfef5 // indirect
1110
github.com/lusis/slack-test v0.0.0-20190426140909-c40012f20018 // indirect
1211
github.com/nlopes/slack v0.2.0
1312
github.com/ogier/pflag v0.0.0-20160129220114-45c278ab3607
14-
github.com/pmezard/go-difflib v1.0.0 // indirect
15-
github.com/stretchr/testify v1.2.1
13+
github.com/stretchr/testify v1.6.1
1614
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
1715
)

go.sum

+11-8
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ github.com/containous/flaeg v1.1.2 h1:wch7cY+yHMSAZctaWAVnIXuEsUFhg3HTAmx2SxBAlP
22
github.com/containous/flaeg v1.1.2/go.mod h1:wgw6PDtRURXHKFFV6HOqQxWhUc3k3Hmq22jw+n2qDro=
33
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
44
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5-
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
6-
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
7-
github.com/google/go-github/v27 v27.0.4 h1:N/EEqsvJLgqTbepTiMBz+12KhwLovv6YvwpRezd+4Fg=
8-
github.com/google/go-github/v27 v27.0.4/go.mod h1:/0Gr8pJ55COkmv+S/yPKCczSkUPIM/LnFyubufRNIS0=
5+
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
6+
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
7+
github.com/google/go-github/v32 v32.0.0 h1:q74KVb22spUq0U5HqZ9VCYqQz8YRuOtL/39ZnfwO+NM=
8+
github.com/google/go-github/v32 v32.0.0/go.mod h1:rIEpZD9CTDQwDK9GDrtMTycQNA4JU3qBsCizh3q2WCI=
99
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
1010
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
1111
github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ=
@@ -20,17 +20,20 @@ github.com/ogier/pflag v0.0.0-20160129220114-45c278ab3607 h1:db+rES1EpSjP45xOU3h
2020
github.com/ogier/pflag v0.0.0-20160129220114-45c278ab3607/go.mod h1:zkFki7tvTa0tafRvTBIZTvzYyAu6kQhPZFnshFFPE+g=
2121
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
2222
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
23-
github.com/stretchr/testify v1.2.1 h1:52QO5WkIUcHGIR7EnGagH88x1bUzqGXTC5/1bDTUQ7U=
24-
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
23+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
24+
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
25+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
2526
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
2627
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
2728
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
2829
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
2930
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
3031
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
31-
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 h1:bjcUS9ztw9kFmmIxJInhon/0Is3p+EHBKNgquIzo1OI=
32-
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
3332
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
3433
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
3534
google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs=
3635
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
36+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
37+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
38+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
39+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

kutteri.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"log"
78
"net/http"
@@ -64,7 +65,7 @@ func main() {
6465

6566
flag.AddCommand(versionCmd)
6667
err := flag.Run()
67-
if err != nil && err != pflag.ErrHelp {
68+
if err != nil && !errors.Is(err, pflag.ErrHelp) {
6869
log.Fatalf("Error: %v\n", err)
6970
}
7071
}

locker/time_locker.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import (
99

1010
const ghDateLayout = "2006-01-02T15:04:05-07:00"
1111

12-
// TimeLocker Manage the time lock file
12+
// TimeLocker Manage the time lock file.
1313
type TimeLocker struct {
1414
FilePath string
1515
HourBack time.Duration
1616
}
1717

18-
// GetLastTime Get the last time
18+
// GetLastTime Get the last time.
1919
func (l TimeLocker) GetLastTime() (string, error) {
2020
if _, err := os.Stat(l.FilePath); err != nil {
2121
if os.IsNotExist(err) {
@@ -33,7 +33,7 @@ func (l TimeLocker) GetLastTime() (string, error) {
3333
return string(data), nil
3434
}
3535

36-
// SaveLastTime Save the current time
36+
// SaveLastTime Save the current time.
3737
func (l TimeLocker) SaveLastTime() (string, error) {
3838
srcDate := time.Now().Add(-l.HourBack * time.Hour)
3939
date := srcDate.Format(ghDateLayout)

0 commit comments

Comments
 (0)