Skip to content

Commit 7b5b3bc

Browse files
authored
refactor: use gin.IRouter instead of gin.Engine (#42)
- Change parameter type of `Register` function to `gin.IRouter` - Fix typo in comment in `pprof.go` - Omitted large changes in files diff summary
1 parent 3399be0 commit 7b5b3bc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pprof.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ func getPrefix(prefixOptions ...string) string {
2020
}
2121

2222
// Register the standard HandlerFuncs from the net/http/pprof package with
23-
// the provided gin.Engine. prefixOptions is a optional. If not prefixOptions,
23+
// the provided gin.IRouter. prefixOptions is a optional. If not prefixOptions,
2424
// the default path prefix is used, otherwise first prefixOptions will be path prefix.
25-
func Register(r *gin.Engine, prefixOptions ...string) {
26-
RouteRegister(&(r.RouterGroup), prefixOptions...)
25+
func Register(r gin.IRouter, prefixOptions ...string) {
26+
RouteRegister(r, prefixOptions...)
2727
}
2828

2929
// RouteRegister the standard HandlerFuncs from the net/http/pprof package with
30-
// the provided gin.GrouterGroup. prefixOptions is a optional. If not prefixOptions,
30+
// the provided gin.IRouter. prefixOptions is a optional. If not prefixOptions,
3131
// the default path prefix is used, otherwise first prefixOptions will be path prefix.
32-
func RouteRegister(rg *gin.RouterGroup, prefixOptions ...string) {
32+
func RouteRegister(rg gin.IRouter, prefixOptions ...string) {
3333
prefix := getPrefix(prefixOptions...)
3434

3535
prefixRouter := rg.Group(prefix)

0 commit comments

Comments
 (0)