Skip to content

Commit 0360ec5

Browse files
committed
Enable Diago if not release
1 parent b007281 commit 0360ec5

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/gin-gonic/gin v1.10.0
77
github.com/gouef/diago v0.2.0
88
github.com/gouef/renderer v0.4.1
9-
github.com/gouef/router v0.7.2
9+
github.com/gouef/router v0.8.1
1010
)
1111

1212
replace (

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ github.com/gouef/diago v0.2.0 h1:RxUZDi31Pl5Qmi+FXg1RI9GfcqiyReP5EQNRa41cNaE=
3333
github.com/gouef/diago v0.2.0/go.mod h1:6zO8CwrwLez2h5LDICuY6Wd1tv2p3HTAD/y5F1t29go=
3434
github.com/gouef/renderer v0.4.1 h1:+k6486ELUBLGLsKE64qIY+7KPz1SDioDyLLyn4k/4mw=
3535
github.com/gouef/renderer v0.4.1/go.mod h1:FEW+OpeTQWUjkjEwYekW4dcwNDCb5fj6N8r9bFdZGkQ=
36-
github.com/gouef/router v0.7.2 h1:Hb15pBVtq8uZAyBGUDdDZKa5uK8c4f4rnh+mlY5Gmms=
37-
github.com/gouef/router v0.7.2/go.mod h1:9we+7FyGgduOp//LPXCC0QCNLgmgQpReyQx5Jt76708=
36+
github.com/gouef/router v0.8.1 h1:655w1eLTAtgZBwK64Xc7gsflI/ikLvqkwjpCmnNgLlo=
37+
github.com/gouef/router v0.8.1/go.mod h1:9we+7FyGgduOp//LPXCC0QCNLgmgQpReyQx5Jt76708=
3838
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
3939
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
4040
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=

main.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ import (
1313
func boot() *router.Router {
1414
r := router.NewRouter()
1515
n := r.GetNativeRouter()
16-
d := diago.NewDiago()
17-
d.AddExtension(extensions.NewDiagoLatencyExtension())
18-
d.AddExtension(extensions2.NewDiagoRouteExtension(r))
1916

20-
n.Use(diago.DiagoMiddleware(r, d))
17+
if !r.IsRelease() {
18+
d := diago.NewDiago()
19+
d.AddExtension(extensions.NewDiagoLatencyExtension())
20+
d.AddExtension(extensions2.NewDiagoRouteExtension(r))
21+
22+
n.Use(diago.DiagoMiddleware(r, d))
23+
}
2124

2225
templateHandler := &handlers.TemplateHandler{Router: r}
2326

0 commit comments

Comments
 (0)