Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add go linting as a pre commit hook #52

Merged
merged 1 commit into from
Mar 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -6,11 +6,10 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.13
- name: Set up Go 1.16
uses: actions/setup-go@v1
with:
go-version: 1.13
go-version: 1.16
id: go

- name: Check out code into the Go module directory
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ language: go
go:
- "1.14"
- "1.15"
- "1.16"
- master
install:
- make install
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: install
.PHONY: install test goimports govet golint githooks

install:
go build -v ./...
@@ -9,3 +9,14 @@ test:
goimports:
go get golang.org/x/tools/cmd/goimports
goimports -w twilio

govet: goimports
go vet

golint: govet
shwetha-manvinkurke marked this conversation as resolved.
Show resolved Hide resolved
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.37.0
golangci-lint run

githooks:
cp githooks/pre-commit `git rev-parse --git-dir`/hooks/pre-commit
chmod +x `git rev-parse --git-dir`/hooks/pre-commit
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ The documentation for the Twilio API can be found [here][apidocs].

This library supports the following Go implementations:

* 1.14 & 1.15
* 1.14, 1.15, 1.16

## Installation

2 changes: 1 addition & 1 deletion client/twilio_test.go
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ func TestClient_SendRequestWithRedirect(t *testing.T) {
mockServer := httptest.NewServer(http.HandlerFunc(
func(writer http.ResponseWriter, request *http.Request) {
writer.WriteHeader(307)
writer.Write([]byte(`{"redirect_to": "some_place"}`))
_, _ = writer.Write([]byte(`{"redirect_to": "some_place"}`))
thinkingserious marked this conversation as resolved.
Show resolved Hide resolved
}))
defer mockServer.Close()

2 changes: 2 additions & 0 deletions githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
make golint
make test
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module github.com/twilio/twilio-go

go 1.15
go 1.16
thinkingserious marked this conversation as resolved.
Show resolved Hide resolved

require (
github.com/golangci/golangci-lint v1.37.0 // indirect
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.6.1
github.com/stretchr/testify v1.7.0
golang.org/x/tools v0.1.0 // indirect
)
613 changes: 613 additions & 0 deletions go.sum

Large diffs are not rendered by default.