mirror of
https://github.com/astaxie/beego.git
synced 2024-12-22 16:40:50 +00:00
refactor: use switch instead of if/else to select ProfController type
This commit is contained in:
parent
aa4b66b985
commit
0c85c14eb2
14
pprof.go
14
pprof.go
@ -9,17 +9,17 @@ type ProfController struct {
|
||||
}
|
||||
|
||||
func (this *ProfController) Get() {
|
||||
ptype := this.Ctx.Params[":pp"]
|
||||
if ptype == "" {
|
||||
switch this.Ctx.Params[":pp"] {
|
||||
default:
|
||||
pprof.Index(this.Ctx.ResponseWriter, this.Ctx.Request)
|
||||
} else if ptype == "cmdline" {
|
||||
case "":
|
||||
pprof.Index(this.Ctx.ResponseWriter, this.Ctx.Request)
|
||||
case "cmdline":
|
||||
pprof.Cmdline(this.Ctx.ResponseWriter, this.Ctx.Request)
|
||||
} else if ptype == "profile" {
|
||||
case "profile":
|
||||
pprof.Profile(this.Ctx.ResponseWriter, this.Ctx.Request)
|
||||
} else if ptype == "symbol" {
|
||||
case "symbol":
|
||||
pprof.Symbol(this.Ctx.ResponseWriter, this.Ctx.Request)
|
||||
} else {
|
||||
pprof.Index(this.Ctx.ResponseWriter, this.Ctx.Request)
|
||||
}
|
||||
this.Ctx.ResponseWriter.WriteHeader(200)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user