We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
mycode is:
router := gin.New() router.Use(gin.Recovery()) router.Use(func(ctx *gin.Context) { requestGroup.Add(1) defer requestGroup.Done() ctx.Next() }) router.Use(gin.WrapH(etag.Handler(router, config.HttpETagWeak)))
go version 1.6 gin version 1.7.3
the error is
runtime: goroutine stack exceeds 1000000000-byte limit runtime: sp=0xc0207b0320 stack=[0xc0207b0000, 0xc0407b0000] fatal error: stack overflow runtime stack: runtime.throw(0x5547d7a, 0xe) /Users/xiandong/go/go1.16.6/src/runtime/panic.go:1117 +0x72 runtime.newstack() /Users/xiandong/go/go1.16.6/src/runtime/stack.go:1069 +0x86d runtime.morestack() /Users/xiandong/go/go1.16.6/src/runtime/asm_amd64.s:458 +0x8f goroutine 130 [running]: runtime.getMCache(0xc0003a6000) /Users/xiandong/go/go1.16.6/src/runtime/mcache.go:125 +0x67 fp=0xc0207b0330 sp=0xc0207b0328 pc=0x401ef67 runtime.mallocgc(0x38, 0x547e240, 0x1, 0x0) /Users/xiandong/go/go1.16.6/src/runtime/malloc.go:977 +0x19e fp=0xc0207b03c0 sp=0xc0207b0330 pc=0x4010fbe runtime.newobject(0x547e240, 0x0) /Users/xiandong/go/go1.16.6/src/runtime/malloc.go:1177 +0x38 fp=0xc0207b03f0 sp=0xc0207b03c0 pc=0x4011798 github.com/go-http-utils/etag.Handler.func1(0xc256840, 0xc00a729400, 0xc000216500) /Users/xiandong/go/pkg/mod/github.com/go-http-utils/etag@v0.0.0-20161124023236-513ea8f21eb1/etag.go:56 +0x65 fp=0xc0207b05f8 sp=0xc0207b03f0 pc=0x4f88585 net/http.HandlerFunc.ServeHTTP(0xc00039c420, 0xc256840, 0xc00a729400, 0xc000216500) /Users/xiandong/go/go1.16.6/src/net/http/server.go:2049 +0x44 fp=0xc0207b0620 sp=0xc0207b05f8 pc=0x44beb64 github.com/gin-gonic/gin.WrapH.func1(0xc00a729400) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/utils.go:48 +0xc9 fp=0xc0207b06a0 sp=0xc0207b0620 pc=0x4f84e09 github.com/gin-gonic/gin.(*Context).Next(0xc00a729400) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b06c8 sp=0xc0207b06a0 pc=0x4f67c8f xgit.italki.com/go/user-service/application.NewGinService.func1(0xc00a729400) /Users/xiandong/go/src/xgit.italki.com/go/user-service/application/http.go:95 +0x7c fp=0xc0207b0738 sp=0xc0207b06c8 pc=0x52575fc github.com/gin-gonic/gin.(*Context).Next(0xc00a729400) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b0760 sp=0xc0207b0738 pc=0x4f67c8f github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1(0xc00a729400) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/recovery.go:99 +0xa5 fp=0xc0207b07f8 sp=0xc0207b0760 pc=0x4f84945 github.com/gin-gonic/gin.(*Context).Next(0xc00a729400) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b0820 sp=0xc0207b07f8 pc=0x4f67c8f github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc0003f6000, 0xc00a729400) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/gin.go:489 +0x414 fp=0xc0207b09d8 sp=0xc0207b0820 pc=0x4f75fd4 github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc0003f6000, 0x5624d28, 0xc00a721c00, 0xc000216500) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/gin.go:445 +0xdf fp=0xc0207b0a38 sp=0xc0207b09d8 pc=0x4f75abf github.com/go-http-utils/etag.Handler.func1(0xc256840, 0xc00a729300, 0xc000216500) /Users/xiandong/go/pkg/mod/github.com/go-http-utils/etag@v0.0.0-20161124023236-513ea8f21eb1/etag.go:57 +0x1b4 fp=0xc0207b0c40 sp=0xc0207b0a38 pc=0x4f886d4 net/http.HandlerFunc.ServeHTTP(0xc00039c420, 0xc256840, 0xc00a729300, 0xc000216500) /Users/xiandong/go/go1.16.6/src/net/http/server.go:2049 +0x44 fp=0xc0207b0c68 sp=0xc0207b0c40 pc=0x44beb64 github.com/gin-gonic/gin.WrapH.func1(0xc00a729300) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/utils.go:48 +0xc9 fp=0xc0207b0ce8 sp=0xc0207b0c68 pc=0x4f84e09 github.com/gin-gonic/gin.(*Context).Next(0xc00a729300) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b0d10 sp=0xc0207b0ce8 pc=0x4f67c8f xgit.italki.com/go/user-service/application.NewGinService.func1(0xc00a729300) /Users/xiandong/go/src/xgit.italki.com/go/user-service/application/http.go:95 +0x7c fp=0xc0207b0d80 sp=0xc0207b0d10 pc=0x52575fc github.com/gin-gonic/gin.(*Context).Next(0xc00a729300) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b0da8 sp=0xc0207b0d80 pc=0x4f67c8f github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1(0xc00a729300) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/recovery.go:99 +0xa5 fp=0xc0207b0e40 sp=0xc0207b0da8 pc=0x4f84945 github.com/gin-gonic/gin.(*Context).Next(0xc00a729300) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b0e68 sp=0xc0207b0e40 pc=0x4f67c8f github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc0003f6000, 0xc00a729300) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/gin.go:489 +0x414 fp=0xc0207b1020 sp=0xc0207b0e68 pc=0x4f75fd4 github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc0003f6000, 0x5624d28, 0xc00a721bc0, 0xc000216500) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/gin.go:445 +0xdf fp=0xc0207b1080 sp=0xc0207b1020 pc=0x4f75abf github.com/go-http-utils/etag.Handler.func1(0xc256840, 0xc00a729200, 0xc000216500) /Users/xiandong/go/pkg/mod/github.com/go-http-utils/etag@v0.0.0-20161124023236-513ea8f21eb1/etag.go:57 +0x1b4 fp=0xc0207b1288 sp=0xc0207b1080 pc=0x4f886d4 net/http.HandlerFunc.ServeHTTP(0xc00039c420, 0xc256840, 0xc00a729200, 0xc000216500) /Users/xiandong/go/go1.16.6/src/net/http/server.go:2049 +0x44 fp=0xc0207b12b0 sp=0xc0207b1288 pc=0x44beb64 github.com/gin-gonic/gin.WrapH.func1(0xc00a729200) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/utils.go:48 +0xc9 fp=0xc0207b1330 sp=0xc0207b12b0 pc=0x4f84e09 github.com/gin-gonic/gin.(*Context).Next(0xc00a729200) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b1358 sp=0xc0207b1330 pc=0x4f67c8f xgit.italki.com/go/user-service/application.NewGinService.func1(0xc00a729200) /Users/xiandong/go/src/xgit.italki.com/go/user-service/application/http.go:95 +0x7c fp=0xc0207b13c8 sp=0xc0207b1358 pc=0x52575fc github.com/gin-gonic/gin.(*Context).Next(0xc00a729200) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b13f0 sp=0xc0207b13c8 pc=0x4f67c8f github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1(0xc00a729200) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/recovery.go:99 +0xa5 fp=0xc0207b1488 sp=0xc0207b13f0 pc=0x4f84945 github.com/gin-gonic/gin.(*Context).Next(0xc00a729200) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b14b0 sp=0xc0207b1488 pc=0x4f67c8f github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc0003f6000, 0xc00a729200) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/gin.go:489 +0x414 fp=0xc0207b1668 sp=0xc0207b14b0 pc=0x4f75fd4 github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc0003f6000, 0x5624d28, 0xc00a721b80, 0xc000216500) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/gin.go:445 +0xdf fp=0xc0207b16c8 sp=0xc0207b1668 pc=0x4f75abf github.com/go-http-utils/etag.Handler.func1(0xc256840, 0xc00a729100, 0xc000216500) /Users/xiandong/go/pkg/mod/github.com/go-http-utils/etag@v0.0.0-20161124023236-513ea8f21eb1/etag.go:57 +0x1b4 fp=0xc0207b18d0 sp=0xc0207b16c8 pc=0x4f886d4 net/http.HandlerFunc.ServeHTTP(0xc00039c420, 0xc256840, 0xc00a729100, 0xc000216500) /Users/xiandong/go/go1.16.6/src/net/http/server.go:2049 +0x44 fp=0xc0207b18f8 sp=0xc0207b18d0 pc=0x44beb64 github.com/gin-gonic/gin.WrapH.func1(0xc00a729100) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/utils.go:48 +0xc9 fp=0xc0207b1978 sp=0xc0207b18f8 pc=0x4f84e09 github.com/gin-gonic/gin.(*Context).Next(0xc00a729100) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b19a0 sp=0xc0207b1978 pc=0x4f67c8f xgit.italki.com/go/user-service/application.NewGinService.func1(0xc00a729100) /Users/xiandong/go/src/xgit.italki.com/go/user-service/application/http.go:95 +0x7c fp=0xc0207b1a10 sp=0xc0207b19a0 pc=0x52575fc github.com/gin-gonic/gin.(*Context).Next(0xc00a729100) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b1a38 sp=0xc0207b1a10 pc=0x4f67c8f github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1(0xc00a729100) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/recovery.go:99 +0xa5 fp=0xc0207b1ad0 sp=0xc0207b1a38 pc=0x4f84945 github.com/gin-gonic/gin.(*Context).Next(0xc00a729100) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b1af8 sp=0xc0207b1ad0 pc=0x4f67c8f github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc0003f6000, 0xc00a729100) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/gin.go:489 +0x414 fp=0xc0207b1cb0 sp=0xc0207b1af8 pc=0x4f75fd4 github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc0003f6000, 0x5624d28, 0xc00a721b40, 0xc000216500) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/gin.go:445 +0xdf fp=0xc0207b1d10 sp=0xc0207b1cb0 pc=0x4f75abf github.com/go-http-utils/etag.Handler.func1(0xc256840, 0xc00a729000, 0xc000216500) /Users/xiandong/go/pkg/mod/github.com/go-http-utils/etag@v0.0.0-20161124023236-513ea8f21eb1/etag.go:57 +0x1b4 fp=0xc0207b1f18 sp=0xc0207b1d10 pc=0x4f886d4 net/http.HandlerFunc.ServeHTTP(0xc00039c420, 0xc256840, 0xc00a729000, 0xc000216500) /Users/xiandong/go/go1.16.6/src/net/http/server.go:2049 +0x44 fp=0xc0207b1f40 sp=0xc0207b1f18 pc=0x44beb64 github.com/gin-gonic/gin.WrapH.func1(0xc00a729000) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/utils.go:48 +0xc9 fp=0xc0207b1fc0 sp=0xc0207b1f40 pc=0x4f84e09 github.com/gin-gonic/gin.(*Context).Next(0xc00a729000) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b1fe8 sp=0xc0207b1fc0 pc=0x4f67c8f xgit.italki.com/go/user-service/application.NewGinService.func1(0xc00a729000) /Users/xiandong/go/src/xgit.italki.com/go/user-service/application/http.go:95 +0x7c fp=0xc0207b2058 sp=0xc0207b1fe8 pc=0x52575fc github.com/gin-gonic/gin.(*Context).Next(0xc00a729000) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b2080 sp=0xc0207b2058 pc=0x4f67c8f github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1(0xc00a729000) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/recovery.go:99 +0xa5 fp=0xc0207b2118 sp=0xc0207b2080 pc=0x4f84945 github.com/gin-gonic/gin.(*Context).Next(0xc00a729000) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b2140 sp=0xc0207b2118 pc=0x4f67c8f github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc0003f6000, 0xc00a729000) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/gin.go:489 +0x414 fp=0xc0207b22f8 sp=0xc0207b2140 pc=0x4f75fd4 github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc0003f6000, 0x5624d28, 0xc00a721b00, 0xc000216500) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/gin.go:445 +0xdf fp=0xc0207b2358 sp=0xc0207b22f8 pc=0x4f75abf github.com/go-http-utils/etag.Handler.func1(0xc256840, 0xc00a728f00, 0xc000216500) /Users/xiandong/go/pkg/mod/github.com/go-http-utils/etag@v0.0.0-20161124023236-513ea8f21eb1/etag.go:57 +0x1b4 fp=0xc0207b2560 sp=0xc0207b2358 pc=0x4f886d4 net/http.HandlerFunc.ServeHTTP(0xc00039c420, 0xc256840, 0xc00a728f00, 0xc000216500) /Users/xiandong/go/go1.16.6/src/net/http/server.go:2049 +0x44 fp=0xc0207b2588 sp=0xc0207b2560 pc=0x44beb64 github.com/gin-gonic/gin.WrapH.func1(0xc00a728f00) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/utils.go:48 +0xc9 fp=0xc0207b2608 sp=0xc0207b2588 pc=0x4f84e09 github.com/gin-gonic/gin.(*Context).Next(0xc00a728f00) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b2630 sp=0xc0207b2608 pc=0x4f67c8f xgit.italki.com/go/user-service/application.NewGinService.func1(0xc00a728f00) /Users/xiandong/go/src/xgit.italki.com/go/user-service/application/http.go:95 +0x7c fp=0xc0207b26a0 sp=0xc0207b2630 pc=0x52575fc github.com/gin-gonic/gin.(*Context).Next(0xc00a728f00) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b26c8 sp=0xc0207b26a0 pc=0x4f67c8f github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1(0xc00a728f00) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/recovery.go:99 +0xa5 fp=0xc0207b2760 sp=0xc0207b26c8 pc=0x4f84945 github.com/gin-gonic/gin.(*Context).Next(0xc00a728f00) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b2788 sp=0xc0207b2760 pc=0x4f67c8f github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc0003f6000, 0xc00a728f00) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/gin.go:489 +0x414 fp=0xc0207b2940 sp=0xc0207b2788 pc=0x4f75fd4 github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc0003f6000, 0x5624d28, 0xc00a721ac0, 0xc000216500) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/gin.go:445 +0xdf fp=0xc0207b29a0 sp=0xc0207b2940 pc=0x4f75abf github.com/go-http-utils/etag.Handler.func1(0xc256840, 0xc00a728e00, 0xc000216500) /Users/xiandong/go/pkg/mod/github.com/go-http-utils/etag@v0.0.0-20161124023236-513ea8f21eb1/etag.go:57 +0x1b4 fp=0xc0207b2ba8 sp=0xc0207b29a0 pc=0x4f886d4 net/http.HandlerFunc.ServeHTTP(0xc00039c420, 0xc256840, 0xc00a728e00, 0xc000216500) /Users/xiandong/go/go1.16.6/src/net/http/server.go:2049 +0x44 fp=0xc0207b2bd0 sp=0xc0207b2ba8 pc=0x44beb64 github.com/gin-gonic/gin.WrapH.func1(0xc00a728e00) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/utils.go:48 +0xc9 fp=0xc0207b2c50 sp=0xc0207b2bd0 pc=0x4f84e09 github.com/gin-gonic/gin.(*Context).Next(0xc00a728e00) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b2c78 sp=0xc0207b2c50 pc=0x4f67c8f xgit.italki.com/go/user-service/application.NewGinService.func1(0xc00a728e00) /Users/xiandong/go/src/xgit.italki.com/go/user-service/application/http.go:95 +0x7c fp=0xc0207b2ce8 sp=0xc0207b2c78 pc=0x52575fc github.com/gin-gonic/gin.(*Context).Next(0xc00a728e00) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/context.go:165 +0x8f fp=0xc0207b2d10 sp=0xc0207b2ce8 pc=0x4f67c8f github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1(0xc00a728e00) /Users/xiandong/go/pkg/mod/github.com/gin-gonic/gin@v1.7.3/recovery.go:99 +0xa5 fp=0xc0207b2da8 sp=0xc0207b2d10 pc=0x4f84945 github.com/gin-gonic/gin.(*Context).Next(0xc00a728e00) ...
The text was updated successfully, but these errors were encountered:
Don't use it as a middleware, wrap the router instead:
https://gin-gonic.com/docs/examples/custom-http-config
s := &http.Server{} s.Handler = etag.Handler(r, false)
Sorry, something went wrong.
No branches or pull requests
mycode is:
go version 1.6
gin version 1.7.3
the error is
The text was updated successfully, but these errors were encountered: