Preparations for the go modules way of work

This commit is contained in:
Anton Krivenko
2021-01-10 01:30:18 +03:00
parent e6bb8aa4b7
commit 433ece5b7b
13 changed files with 70 additions and 39 deletions
+16
View File
@@ -0,0 +1,16 @@
run:
tests: false
skip-dirs:
- _examples
linters:
enable:
- vet
- vetshadow
- golint
- megacheck
- ineffassign
- misspell
- errcheck
- goconst
- gofmt
+2 -7
View File
@@ -16,17 +16,12 @@ before_install:
- go get -u github.com/go-playground/overalls - go get -u github.com/go-playground/overalls
- go get -u github.com/mattn/goveralls - go get -u github.com/mattn/goveralls
- go get -u golang.org/x/tools/cmd/cover - go get -u golang.org/x/tools/cmd/cover
- mkdir -p $GOPATH/src/gopkg.in
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v2
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v3
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v4
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v5
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v6
before_script: before_script:
- go get -t ./... - go mod download
script: script:
- make lint
- make test - make test
after_success: | after_success: |
+8 -8
View File
@@ -1,17 +1,17 @@
GOCMD=go GOPATH=$(shell go env GOPATH)
linters-install: linters-install:
@gometalinter --version >/dev/null 2>&1 || { \ @echo "+ $@"
echo "installing linting tools..."; \ @$(GOPATH)/bin/golangci-lint --version >/dev/null 2>&1 || { \
$(GOCMD) get github.com/alecthomas/gometalinter; \ echo "Install golangci-lint..."; \
gometalinter --install; \ curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin; \
} }
lint: linters-install lint: linters-install
@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 @echo "+ $@"
gometalinter --vendor --disable-all --enable=vet --enable=vetshadow --enable=golint --enable=megacheck --enable=ineffassign --enable=misspell --enable=errcheck --enable=goconst ./... $(GOPATH)/bin/golangci-lint run ./...
test: test:
$(GOCMD) test -cover -race ./... GO111MODULE=on go test -cover -race ./...
.PHONY: test lint linters-install .PHONY: test lint linters-install
+5 -5
View File
@@ -4,7 +4,7 @@ Library webhooks
[![Build Status](https://travis-ci.org/go-playground/webhooks.svg?branch=v6)](https://travis-ci.org/go-playground/webhooks) [![Build Status](https://travis-ci.org/go-playground/webhooks.svg?branch=v6)](https://travis-ci.org/go-playground/webhooks)
[![Coverage Status](https://coveralls.io/repos/go-playground/webhooks/badge.svg?branch=v6&service=github)](https://coveralls.io/github/go-playground/webhooks?branch=v6) [![Coverage Status](https://coveralls.io/repos/go-playground/webhooks/badge.svg?branch=v6&service=github)](https://coveralls.io/github/go-playground/webhooks?branch=v6)
[![Go Report Card](https://goreportcard.com/badge/go-playground/webhooks)](https://goreportcard.com/report/go-playground/webhooks) [![Go Report Card](https://goreportcard.com/badge/go-playground/webhooks)](https://goreportcard.com/report/go-playground/webhooks)
[![GoDoc](https://godoc.org/gopkg.in/go-playground/webhooks.v6?status.svg)](https://godoc.org/gopkg.in/go-playground/webhooks.v6) [![GoDoc](https://godoc.org/github.com/go-playground/webhooks/v6?status.svg)](https://godoc.org/github.com/go-playground/webhooks/v6)
![License](https://img.shields.io/dub/l/vibe-d.svg) ![License](https://img.shields.io/dub/l/vibe-d.svg)
Library webhooks allows for easy receiving and parsing of GitHub, Bitbucket and GitLab Webhook Events Library webhooks allows for easy receiving and parsing of GitHub, Bitbucket and GitLab Webhook Events
@@ -24,17 +24,17 @@ Installation
Use go get. Use go get.
```shell ```shell
go get -u gopkg.in/go-playground/webhooks.v6 go get -u github.com/go-playground/webhooks/v6
``` ```
Then import the package into your own code. Then import the package into your own code.
import "gopkg.in/go-playground/webhooks.v6" import "github.com/go-playground/webhooks/v6"
Usage and Documentation Usage and Documentation
------ ------
Please see http://godoc.org/gopkg.in/go-playground/webhooks.v6 for detailed usage docs. Please see http://godoc.org/github.com/go-playground/webhooks/v6 for detailed usage docs.
##### Examples: ##### Examples:
```go ```go
@@ -45,7 +45,7 @@ import (
"net/http" "net/http"
"gopkg.in/go-playground/webhooks.v6/github" "github.com/go-playground/webhooks/v6/github"
) )
const ( const (
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"net/http" "net/http"
"gopkg.in/go-playground/webhooks.v6/github" "github.com/go-playground/webhooks/v6/github"
) )
const ( const (
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"net/http" "net/http"
"gopkg.in/go-playground/webhooks.v6/github" "github.com/go-playground/webhooks/v6/github"
) )
const ( const (
+6 -6
View File
@@ -147,7 +147,7 @@ type PullRequestCommentAddedPayload struct {
Actor User `json:"actor"` Actor User `json:"actor"`
PullRequest PullRequest `json:"pullRequest"` PullRequest PullRequest `json:"pullRequest"`
Comment Comment `json:"comment"` Comment Comment `json:"comment"`
CommentParentId uint64 `json:"commentParentId,omitempty"` CommentParentID uint64 `json:"commentParentId,omitempty"`
} }
type PullRequestCommentEditedPayload struct { type PullRequestCommentEditedPayload struct {
@@ -156,7 +156,7 @@ type PullRequestCommentEditedPayload struct {
Actor User `json:"actor"` Actor User `json:"actor"`
PullRequest PullRequest `json:"pullRequest"` PullRequest PullRequest `json:"pullRequest"`
Comment Comment `json:"comment"` Comment Comment `json:"comment"`
CommentParentId string `json:"commentParentId,omitempty"` CommentParentID string `json:"commentParentId,omitempty"`
PreviousComment string `json:"previousComment"` PreviousComment string `json:"previousComment"`
} }
@@ -166,7 +166,7 @@ type PullRequestCommentDeletedPayload struct {
Actor User `json:"actor"` Actor User `json:"actor"`
PullRequest PullRequest `json:"pullRequest"` PullRequest PullRequest `json:"pullRequest"`
Comment Comment `json:"comment"` Comment Comment `json:"comment"`
CommentParentId uint64 `json:"commentParentId,omitempty"` CommentParentID uint64 `json:"commentParentId,omitempty"`
} }
// ----------------------- // -----------------------
@@ -186,7 +186,7 @@ type Repository struct {
ID uint64 `json:"id"` ID uint64 `json:"id"`
Slug string `json:"slug"` Slug string `json:"slug"`
Name string `json:"name"` Name string `json:"name"`
ScmId string `json:"scmId"` ScmID string `json:"scmId"`
State string `json:"state"` State string `json:"state"`
StatusMessage string `json:"statusMessage"` StatusMessage string `json:"statusMessage"`
Forkable bool `json:"forkable"` Forkable bool `json:"forkable"`
@@ -229,7 +229,7 @@ type PullRequest struct {
type RepositoryChange struct { type RepositoryChange struct {
Reference RepositoryReference `json:"ref"` Reference RepositoryReference `json:"ref"`
ReferenceId string `json:"refId"` ReferenceID string `json:"refId"`
FromHash string `json:"fromHash"` FromHash string `json:"fromHash"`
ToHash string `json:"toHash"` ToHash string `json:"toHash"`
Type string `json:"type"` Type string `json:"type"`
@@ -237,7 +237,7 @@ type RepositoryChange struct {
type RepositoryReference struct { type RepositoryReference struct {
ID string `json:"id"` ID string `json:"id"`
DisplayId string `json:"displayId"` DisplayID string `json:"displayId"`
Type string `json:"type,omitempty"` Type string `json:"type,omitempty"`
LatestCommit string `json:"latestCommit,omitempty"` LatestCommit string `json:"latestCommit,omitempty"`
Repository Repository `json:"repository,omitempty"` Repository Repository `json:"repository,omitempty"`
+1 -1
View File
@@ -350,7 +350,7 @@ type Owner struct {
Type string `json:"type"` Type string `json:"type"`
NickName string `json:"nickname"` NickName string `json:"nickname"`
DisplayName string `json:"display_name"` DisplayName string `json:"display_name"`
AccountId string `json:"account_id"` AccountID string `json:"account_id"`
UUID string `json:"uuid"` UUID string `json:"uuid"`
Links struct { Links struct {
Self struct { Self struct {
+1 -2
View File
@@ -1,6 +1,6 @@
package docker package docker
// this package recieves the Docker Hub Automated Build webhook // this package receives the Docker Hub Automated Build webhook
// https://docs.docker.com/docker-hub/webhooks/ // https://docs.docker.com/docker-hub/webhooks/
// NOT the Docker Trusted Registry webhook // NOT the Docker Trusted Registry webhook
// https://docs.docker.com/ee/dtr/user/create-and-manage-webhooks/ // https://docs.docker.com/ee/dtr/user/create-and-manage-webhooks/
@@ -58,7 +58,6 @@ type BuildPayload struct {
// Webhook instance contains all methods needed to process events // Webhook instance contains all methods needed to process events
type Webhook struct { type Webhook struct {
secret string
} }
// New creates and returns a WebHook instance // New creates and returns a WebHook instance
+4 -4
View File
@@ -13,7 +13,7 @@ type CheckRunPayload struct {
Status string `json:"status"` Status string `json:"status"`
Conclusion string `json:"conclusion"` Conclusion string `json:"conclusion"`
URL string `json:"url"` URL string `json:"url"`
HtmlURL string `json:"html_url"` HTMLURL string `json:"html_url"`
StarterAt time.Time `json:"started_at"` StarterAt time.Time `json:"started_at"`
CompletedAt time.Time `json:"completed_at"` CompletedAt time.Time `json:"completed_at"`
Output struct { Output struct {
@@ -59,7 +59,7 @@ type CheckRunPayload struct {
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description"` Description string `json:"description"`
ExternalURL string `json:"external_url"` ExternalURL string `json:"external_url"`
HtmlURL string `json:"html_url"` HTMLURL string `json:"html_url"`
CreatedAt string `json:"created_at"` CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"` UpdatedAt string `json:"updated_at"`
} `json:"app"` } `json:"app"`
@@ -92,7 +92,7 @@ type CheckRunPayload struct {
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description"` Description string `json:"description"`
ExternalURL string `json:"external_url"` ExternalURL string `json:"external_url"`
HtmlURL string `json:"html_url"` HTMLURL string `json:"html_url"`
CreatedAt string `json:"created_at"` CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"` UpdatedAt string `json:"updated_at"`
} `json:"app"` } `json:"app"`
@@ -249,7 +249,7 @@ type CheckSuitePayload struct {
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description"` Description string `json:"description"`
ExternalURL string `json:"external_url"` ExternalURL string `json:"external_url"`
HtmlURL string `json:"html_url"` HTMLURL string `json:"html_url"`
CreatedAt string `json:"created_at"` CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"` UpdatedAt string `json:"updated_at"`
} `json:"app"` } `json:"app"`
+3 -3
View File
@@ -257,7 +257,7 @@ type BuildCommit struct {
ID int64 `json:"id"` ID int64 `json:"id"`
SHA string `json:"sha"` SHA string `json:"sha"`
Message string `json:"message"` Message string `json:"message"`
AuthorName string `json:"auuthor_name"` AuthorName string `json:"author_name"`
AuthorEmail string `json:"author_email"` AuthorEmail string `json:"author_email"`
Status string `json:"status"` Status string `json:"status"`
Duration int64 `json:"duration"` Duration int64 `json:"duration"`
@@ -363,11 +363,11 @@ type ObjectAttributes struct {
Stages []string `json:"stages"` Stages []string `json:"stages"`
Duration int64 `json:"duration"` Duration int64 `json:"duration"`
Note string `json:"note"` Note string `json:"note"`
NotebookType string `json:"noteable_type"` NotebookType string `json:"noteable_type"` // nolint:misspell
At customTime `json:"attachment"` At customTime `json:"attachment"`
LineCode string `json:"line_code"` LineCode string `json:"line_code"`
CommitID string `json:"commit_id"` CommitID string `json:"commit_id"`
NoteableID int64 `json:"noteable_id"` NoteableID int64 `json:"noteable_id"` // nolint: misspell
System bool `json:"system"` System bool `json:"system"`
WorkInProgress bool `json:"work_in_progress"` WorkInProgress bool `json:"work_in_progress"`
StDiffs []StDiff `json:"st_diffs"` StDiffs []StDiff `json:"st_diffs"`
+8
View File
@@ -0,0 +1,8 @@
module github.com/go-playground/webhooks/v6
go 1.15
require (
github.com/gogits/go-gogs-client v0.0.0-20200905025246-8bb8a50cb355
github.com/stretchr/testify v1.6.1
)
+13
View File
@@ -0,0 +1,13 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gogits/go-gogs-client v0.0.0-20200905025246-8bb8a50cb355 h1:HTVNOdTWO/gHYeFnr/HwpYwY6tgMcYd+Rgf1XrHnORY=
github.com/gogits/go-gogs-client v0.0.0-20200905025246-8bb8a50cb355/go.mod h1:cY2AIrMgHm6oOHmR7jY+9TtjzSjQ3iG7tURJG3Y6XH0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=