Skip to content

Commit

Permalink
fix: golang ci lint
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 Feb 3, 2022
1 parent c7e1837 commit e36bef7
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 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: 2 additions & 3 deletions recovey.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ import (

// Recovery middleware for rollbar error monitoring
func Recovery(onlyCrashes bool) gin.HandlerFunc {

return func(c *gin.Context) {
defer func() {

if rval := recover(); rval != nil {
debug.PrintStack()

rollbar.Critical(errors.New(fmt.Sprint(rval)), getCallers(3), map[string]string{
"endpoint": c.Request.RequestURI})
"endpoint": c.Request.RequestURI,
})

c.AbortWithStatus(http.StatusInternalServerError)
}
Expand Down

0 comments on commit e36bef7

Please sign in to comment.