Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
26 changes: 22 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,29 @@ jobs:
matrix:
go: [ '1.21', '1.20', '1.19', '1.18']
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
- name: Setup Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ matrix.go }}

- name: Build Go
run: go build ./...

- name: test
run: go test -race . -v
- name: Run golangci-lint
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5

- name: run test and generate coverage report
run: go test -race ./... -v -coverprofile=coverage.out

- name: Upload coverage report
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
path: coverage.out
name: Coverage-report-${{matrix.go}}

- name: Display coverage report
run: go tool cover -func=coverage.out

4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
linters:
disable:
- unused
- errcheck
2 changes: 1 addition & 1 deletion examples/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func TestHttpErrorWhenHeaderDoesNotMatch(t *testing.T) {
}

func TestHttpErrorWhenMethodDoesNotMatch(t *testing.T) {
r, err := http.NewRequest(http.MethodPatch, "/blogs", nil)
r, err := http.NewRequest(http.MethodOptions, "/blogs", nil)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is currently failing in the main branch. It is failing because previously there wasn't any handling for the method http.MethodPatch but around an year back code was added for this case as well.
I have changed the http method to an unhandled path, so that the test case runs as expected

if err != nil {
t.Fatal(err)
}
Expand Down
Loading