Skip to content

Commit 599e359

Browse files
committed
Fix and remove 14.6.md spaces
1 parent 4416cab commit 599e359

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

zh/14.6.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,39 @@ runtime/pprof
1414
- 首先在beego.Run函数中根据变量是否自动加载性能包
1515
```Go
1616

17-
if PprofOn {
18-
BeeApp.RegisterController(`/debug/pprof`, &ProfController{})
19-
BeeApp.RegisterController(`/debug/pprof/:pp([\w]+)`, &ProfController{})
20-
}
17+
if PprofOn {
18+
BeeApp.RegisterController(`/debug/pprof`, &ProfController{})
19+
BeeApp.RegisterController(`/debug/pprof/:pp([\w]+)`, &ProfController{})
20+
}
2121
```
2222
- 设计ProfConterller
2323
```Go
2424

25-
package beego
26-
27-
import (
28-
"net/http/pprof"
29-
)
30-
31-
type ProfController struct {
32-
Controller
33-
}
34-
35-
func (this *ProfController) Get() {
36-
switch this.Ctx.Params[":pp"] {
37-
default:
38-
pprof.Index(this.Ctx.ResponseWriter, this.Ctx.Request)
39-
case "":
40-
pprof.Index(this.Ctx.ResponseWriter, this.Ctx.Request)
41-
case "cmdline":
42-
pprof.Cmdline(this.Ctx.ResponseWriter, this.Ctx.Request)
43-
case "profile":
44-
pprof.Profile(this.Ctx.ResponseWriter, this.Ctx.Request)
45-
case "symbol":
46-
pprof.Symbol(this.Ctx.ResponseWriter, this.Ctx.Request)
47-
}
48-
this.Ctx.ResponseWriter.WriteHeader(200)
25+
package beego
26+
27+
import (
28+
"net/http/pprof"
29+
)
30+
31+
type ProfController struct {
32+
Controller
33+
}
34+
35+
func (this *ProfController) Get() {
36+
switch this.Ctx.Params[":pp"] {
37+
default:
38+
pprof.Index(this.Ctx.ResponseWriter, this.Ctx.Request)
39+
case "":
40+
pprof.Index(this.Ctx.ResponseWriter, this.Ctx.Request)
41+
case "cmdline":
42+
pprof.Cmdline(this.Ctx.ResponseWriter, this.Ctx.Request)
43+
case "profile":
44+
pprof.Profile(this.Ctx.ResponseWriter, this.Ctx.Request)
45+
case "symbol":
46+
pprof.Symbol(this.Ctx.ResponseWriter, this.Ctx.Request)
4947
}
48+
this.Ctx.ResponseWriter.WriteHeader(200)
49+
}
5050

5151
```
5252
## 使用入门

0 commit comments

Comments
 (0)