1
0
mirror of https://github.com/beego/bee.git synced 2024-11-23 06:40:54 +00:00

trim space before process

This commit is contained in:
JessonChan 2016-03-25 14:58:36 +08:00
parent 2b797200df
commit 99997b7d35

3
fix.go
View File

@ -211,7 +211,9 @@ func fixFile(file string) error {
fixed = strings.Replace(fixed, "AdminHttpPort", "AdminPort", -1) fixed = strings.Replace(fixed, "AdminHttpPort", "AdminPort", -1)
fixed = strings.Replace(fixed, "HttpServerTimeOut", "ServerTimeOut", -1) fixed = strings.Replace(fixed, "HttpServerTimeOut", "ServerTimeOut", -1)
} }
if strings.HasSuffix(file, ".go") {
fixed = fixLogModule(fixed) fixed = fixLogModule(fixed)
}
err = os.Truncate(file, 0) err = os.Truncate(file, 0)
if err != nil { if err != nil {
return err return err
@ -264,6 +266,7 @@ func fixLogModule(fixed string) string {
needBeego := false needBeego := false
slash := false slash := false
for _, line := range strings.Split(fixed, "\n") { for _, line := range strings.Split(fixed, "\n") {
line = strings.TrimSpace(line)
if strings.HasPrefix(line, "//") { if strings.HasPrefix(line, "//") {
continue continue
} }