Skip to content

Commit

Permalink
chore(lint): add golangci config
Browse files Browse the repository at this point in the history
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
  • Loading branch information
appleboy committed Jan 5, 2022
1 parent b804732 commit df02b4a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
43 changes: 43 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
linters:
enable-all: false
disable-all: true
fast: false
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- exportloopref
- exhaustive
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- noctx
- nolintlint
- rowserrcheck
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
- gofumpt

run:
timeout: 3m
5 changes: 3 additions & 2 deletions requestid_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package requestid

import (
"context"
"net/http"
"net/http/httptest"
"testing"
Expand All @@ -21,7 +22,7 @@ func Test_RequestID_CreateNew(t *testing.T) {
r.GET("/", emptySuccessResponse)

w := httptest.NewRecorder()
req, _ := http.NewRequest("GET", "/", nil)
req, _ := http.NewRequestWithContext(context.Background(), "GET", "/", nil)
r.ServeHTTP(w, req)

assert.Equal(t, http.StatusOK, w.Code)
Expand All @@ -34,7 +35,7 @@ func Test_RequestID_PassThru(t *testing.T) {
r.GET("/", emptySuccessResponse)

w := httptest.NewRecorder()
req, _ := http.NewRequest("GET", "/", nil)
req, _ := http.NewRequestWithContext(context.Background(), "GET", "/", nil)
req.Header.Set(headerXRequestID, testXRequestID)
r.ServeHTTP(w, req)

Expand Down

0 comments on commit df02b4a

Please sign in to comment.