Skip to content

Commit 433ece5

Browse files
committed
Preparations for the go modules way of work
1 parent e6bb8aa commit 433ece5

File tree

13 files changed

+70
-39
lines changed

13 files changed

+70
-39
lines changed

Diff for: .golangci.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
run:
2+
tests: false
3+
skip-dirs:
4+
- _examples
5+
6+
linters:
7+
enable:
8+
- vet
9+
- vetshadow
10+
- golint
11+
- megacheck
12+
- ineffassign
13+
- misspell
14+
- errcheck
15+
- goconst
16+
- gofmt

Diff for: .travis.yml

+2-7
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,12 @@ before_install:
1616
- go get -u github.com/go-playground/overalls
1717
- go get -u github.com/mattn/goveralls
1818
- go get -u golang.org/x/tools/cmd/cover
19-
- mkdir -p $GOPATH/src/gopkg.in
20-
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v2
21-
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v3
22-
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v4
23-
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v5
24-
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v6
2519

2620
before_script:
27-
- go get -t ./...
21+
- go mod download
2822

2923
script:
24+
- make lint
3025
- make test
3126

3227
after_success: |

Diff for: Makefile

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
GOCMD=go
1+
GOPATH=$(shell go env GOPATH)
22

33
linters-install:
4-
@gometalinter --version >/dev/null 2>&1 || { \
5-
echo "installing linting tools..."; \
6-
$(GOCMD) get github.com/alecthomas/gometalinter; \
7-
gometalinter --install; \
4+
@echo "+ $@"
5+
@$(GOPATH)/bin/golangci-lint --version >/dev/null 2>&1 || { \
6+
echo "Install golangci-lint..."; \
7+
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin; \
88
}
99

1010
lint: linters-install
11-
@gofmt -l . >gofmt.test 2>&1 && if [ -s gofmt.test ]; then echo "Fix formatting using 'gofmt -s -w .' for:"; cat gofmt.test; exit 1; fi && rm gofmt.test
12-
gometalinter --vendor --disable-all --enable=vet --enable=vetshadow --enable=golint --enable=megacheck --enable=ineffassign --enable=misspell --enable=errcheck --enable=goconst ./...
11+
@echo "+ $@"
12+
$(GOPATH)/bin/golangci-lint run ./...
1313

1414
test:
15-
$(GOCMD) test -cover -race ./...
15+
GO111MODULE=on go test -cover -race ./...
1616

17-
.PHONY: test lint linters-install
17+
.PHONY: test lint linters-install

Diff for: README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Library webhooks
44
[![Build Status](https://travis-ci.org/go-playground/webhooks.svg?branch=v6)](https://travis-ci.org/go-playground/webhooks)
55
[![Coverage Status](https://coveralls.io/repos/go-playground/webhooks/badge.svg?branch=v6&service=github)](https://coveralls.io/github/go-playground/webhooks?branch=v6)
66
[![Go Report Card](https://goreportcard.com/badge/go-playground/webhooks)](https://goreportcard.com/report/go-playground/webhooks)
7-
[![GoDoc](https://godoc.org/gopkg.in/go-playground/webhooks.v6?status.svg)](https://godoc.org/gopkg.in/go-playground/webhooks.v6)
7+
[![GoDoc](https://godoc.org/github.com/go-playground/webhooks/v6?status.svg)](https://godoc.org/github.com/go-playground/webhooks/v6)
88
![License](https://img.shields.io/dub/l/vibe-d.svg)
99

1010
Library webhooks allows for easy receiving and parsing of GitHub, Bitbucket and GitLab Webhook Events
@@ -24,17 +24,17 @@ Installation
2424
Use go get.
2525

2626
```shell
27-
go get -u gopkg.in/go-playground/webhooks.v6
27+
go get -u github.com/go-playground/webhooks/v6
2828
```
2929

3030
Then import the package into your own code.
3131

32-
import "gopkg.in/go-playground/webhooks.v6"
32+
import "github.com/go-playground/webhooks/v6"
3333

3434
Usage and Documentation
3535
------
3636

37-
Please see http://godoc.org/gopkg.in/go-playground/webhooks.v6 for detailed usage docs.
37+
Please see http://godoc.org/github.com/go-playground/webhooks/v6 for detailed usage docs.
3838

3939
##### Examples:
4040
```go
@@ -45,7 +45,7 @@ import (
4545

4646
"net/http"
4747

48-
"gopkg.in/go-playground/webhooks.v6/github"
48+
"github.com/go-playground/webhooks/v6/github"
4949
)
5050

5151
const (

Diff for: _examples/multiple-handlers/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"net/http"
77

8-
"gopkg.in/go-playground/webhooks.v6/github"
8+
"github.com/go-playground/webhooks/v6/github"
99
)
1010

1111
const (

Diff for: _examples/single-handler/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"net/http"
77

8-
"gopkg.in/go-playground/webhooks.v6/github"
8+
"github.com/go-playground/webhooks/v6/github"
99
)
1010

1111
const (

Diff for: bitbucket-server/payload.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ type PullRequestCommentAddedPayload struct {
147147
Actor User `json:"actor"`
148148
PullRequest PullRequest `json:"pullRequest"`
149149
Comment Comment `json:"comment"`
150-
CommentParentId uint64 `json:"commentParentId,omitempty"`
150+
CommentParentID uint64 `json:"commentParentId,omitempty"`
151151
}
152152

153153
type PullRequestCommentEditedPayload struct {
@@ -156,7 +156,7 @@ type PullRequestCommentEditedPayload struct {
156156
Actor User `json:"actor"`
157157
PullRequest PullRequest `json:"pullRequest"`
158158
Comment Comment `json:"comment"`
159-
CommentParentId string `json:"commentParentId,omitempty"`
159+
CommentParentID string `json:"commentParentId,omitempty"`
160160
PreviousComment string `json:"previousComment"`
161161
}
162162

@@ -166,7 +166,7 @@ type PullRequestCommentDeletedPayload struct {
166166
Actor User `json:"actor"`
167167
PullRequest PullRequest `json:"pullRequest"`
168168
Comment Comment `json:"comment"`
169-
CommentParentId uint64 `json:"commentParentId,omitempty"`
169+
CommentParentID uint64 `json:"commentParentId,omitempty"`
170170
}
171171

172172
// -----------------------
@@ -186,7 +186,7 @@ type Repository struct {
186186
ID uint64 `json:"id"`
187187
Slug string `json:"slug"`
188188
Name string `json:"name"`
189-
ScmId string `json:"scmId"`
189+
ScmID string `json:"scmId"`
190190
State string `json:"state"`
191191
StatusMessage string `json:"statusMessage"`
192192
Forkable bool `json:"forkable"`
@@ -229,15 +229,15 @@ type PullRequest struct {
229229

230230
type RepositoryChange struct {
231231
Reference RepositoryReference `json:"ref"`
232-
ReferenceId string `json:"refId"`
232+
ReferenceID string `json:"refId"`
233233
FromHash string `json:"fromHash"`
234234
ToHash string `json:"toHash"`
235235
Type string `json:"type"`
236236
}
237237

238238
type RepositoryReference struct {
239239
ID string `json:"id"`
240-
DisplayId string `json:"displayId"`
240+
DisplayID string `json:"displayId"`
241241
Type string `json:"type,omitempty"`
242242
LatestCommit string `json:"latestCommit,omitempty"`
243243
Repository Repository `json:"repository,omitempty"`

Diff for: bitbucket/payload.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ type Owner struct {
350350
Type string `json:"type"`
351351
NickName string `json:"nickname"`
352352
DisplayName string `json:"display_name"`
353-
AccountId string `json:"account_id"`
353+
AccountID string `json:"account_id"`
354354
UUID string `json:"uuid"`
355355
Links struct {
356356
Self struct {

Diff for: docker/docker.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package docker
22

3-
// this package recieves the Docker Hub Automated Build webhook
3+
// this package receives the Docker Hub Automated Build webhook
44
// https://docs.docker.com/docker-hub/webhooks/
55
// NOT the Docker Trusted Registry webhook
66
// https://docs.docker.com/ee/dtr/user/create-and-manage-webhooks/
@@ -58,7 +58,6 @@ type BuildPayload struct {
5858

5959
// Webhook instance contains all methods needed to process events
6060
type Webhook struct {
61-
secret string
6261
}
6362

6463
// New creates and returns a WebHook instance

Diff for: github/payload.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type CheckRunPayload struct {
1313
Status string `json:"status"`
1414
Conclusion string `json:"conclusion"`
1515
URL string `json:"url"`
16-
HtmlURL string `json:"html_url"`
16+
HTMLURL string `json:"html_url"`
1717
StarterAt time.Time `json:"started_at"`
1818
CompletedAt time.Time `json:"completed_at"`
1919
Output struct {
@@ -59,7 +59,7 @@ type CheckRunPayload struct {
5959
Name string `json:"name"`
6060
Description string `json:"description"`
6161
ExternalURL string `json:"external_url"`
62-
HtmlURL string `json:"html_url"`
62+
HTMLURL string `json:"html_url"`
6363
CreatedAt string `json:"created_at"`
6464
UpdatedAt string `json:"updated_at"`
6565
} `json:"app"`
@@ -92,7 +92,7 @@ type CheckRunPayload struct {
9292
Name string `json:"name"`
9393
Description string `json:"description"`
9494
ExternalURL string `json:"external_url"`
95-
HtmlURL string `json:"html_url"`
95+
HTMLURL string `json:"html_url"`
9696
CreatedAt string `json:"created_at"`
9797
UpdatedAt string `json:"updated_at"`
9898
} `json:"app"`
@@ -249,7 +249,7 @@ type CheckSuitePayload struct {
249249
Name string `json:"name"`
250250
Description string `json:"description"`
251251
ExternalURL string `json:"external_url"`
252-
HtmlURL string `json:"html_url"`
252+
HTMLURL string `json:"html_url"`
253253
CreatedAt string `json:"created_at"`
254254
UpdatedAt string `json:"updated_at"`
255255
} `json:"app"`

Diff for: gitlab/payload.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ type BuildCommit struct {
257257
ID int64 `json:"id"`
258258
SHA string `json:"sha"`
259259
Message string `json:"message"`
260-
AuthorName string `json:"auuthor_name"`
260+
AuthorName string `json:"author_name"`
261261
AuthorEmail string `json:"author_email"`
262262
Status string `json:"status"`
263263
Duration int64 `json:"duration"`
@@ -363,11 +363,11 @@ type ObjectAttributes struct {
363363
Stages []string `json:"stages"`
364364
Duration int64 `json:"duration"`
365365
Note string `json:"note"`
366-
NotebookType string `json:"noteable_type"`
366+
NotebookType string `json:"noteable_type"` // nolint:misspell
367367
At customTime `json:"attachment"`
368368
LineCode string `json:"line_code"`
369369
CommitID string `json:"commit_id"`
370-
NoteableID int64 `json:"noteable_id"`
370+
NoteableID int64 `json:"noteable_id"` // nolint: misspell
371371
System bool `json:"system"`
372372
WorkInProgress bool `json:"work_in_progress"`
373373
StDiffs []StDiff `json:"st_diffs"`

Diff for: go.mod

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module github.com/go-playground/webhooks/v6
2+
3+
go 1.15
4+
5+
require (
6+
github.com/gogits/go-gogs-client v0.0.0-20200905025246-8bb8a50cb355
7+
github.com/stretchr/testify v1.6.1
8+
)

Diff for: go.sum

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
2+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/gogits/go-gogs-client v0.0.0-20200905025246-8bb8a50cb355 h1:HTVNOdTWO/gHYeFnr/HwpYwY6tgMcYd+Rgf1XrHnORY=
4+
github.com/gogits/go-gogs-client v0.0.0-20200905025246-8bb8a50cb355/go.mod h1:cY2AIrMgHm6oOHmR7jY+9TtjzSjQ3iG7tURJG3Y6XH0=
5+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
6+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
8+
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
9+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
10+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
11+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
12+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
13+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)