Skip to content

Commit

Permalink
refactor: use gin.IRouter instead of gin.Engine (#42)
Browse files Browse the repository at this point in the history
- Change parameter type of `Register` function to `gin.IRouter`
- Fix typo in comment in `pprof.go`
- Omitted large changes in files diff summary
  • Loading branch information
Laisky authored May 5, 2024
1 parent 3399be0 commit 7b5b3bc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ func getPrefix(prefixOptions ...string) string {
}

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

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

prefixRouter := rg.Group(prefix)
Expand Down

0 comments on commit 7b5b3bc

Please sign in to comment.