File tree Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 3131 with :
3232 ref : ${{ github.ref }}
3333
34+ - name : golangci-lint
35+ uses : golangci/golangci-lint-action@v2
36+
3437 - name : Run Tests
3538 run : |
3639 go test -v -covermode=atomic -coverprofile=coverage.out
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ Timeout wraps a handler and aborts the process of the handler if the timeout is
1414package main
1515
1616import (
17+ " log"
1718 " net/http"
1819 " time"
1920
@@ -35,8 +36,11 @@ func main() {
3536 ))
3637
3738 // Listen and Server in 0.0.0.0:8080
38- r.Run (" :8080" )
39+ if err := r.Run (" :8080" ); err != nil {
40+ log.Fatal (err)
41+ }
3942}
43+
4044```
4145
4246### custom error response
Original file line number Diff line number Diff line change 11package main
22
33import (
4+ "log"
45 "net/http"
56 "time"
67
@@ -22,5 +23,7 @@ func main() {
2223 ))
2324
2425 // Listen and Server in 0.0.0.0:8080
25- r .Run (":8080" )
26+ if err := r .Run (":8080" ); err != nil {
27+ log .Fatal (err )
28+ }
2629}
Original file line number Diff line number Diff line change @@ -42,9 +42,7 @@ type Timeout struct {
4242 response gin.HandlerFunc
4343}
4444
45- var (
46- buffpool * BufferPool
47- )
45+ var buffpool * BufferPool
4846
4947// New wraps a handler and aborts the process of the handler if the timeout is reached
5048func New (opts ... Option ) gin.HandlerFunc {
@@ -104,7 +102,9 @@ func New(opts ...Option) gin.HandlerFunc {
104102 dst [k ] = vv
105103 }
106104 tw .ResponseWriter .WriteHeader (tw .code )
107- tw .ResponseWriter .Write (buffer .Bytes ())
105+ if _ , err := tw .ResponseWriter .Write (buffer .Bytes ()); err != nil {
106+ panic (err )
107+ }
108108 tw .FreeBuffer ()
109109 buffpool .Put (buffer )
110110
You can’t perform that action at this time.
0 commit comments