fix #770
Showing
1 changed file
with
4 additions
and
2 deletions
| ... | @@ -42,6 +42,7 @@ func init() { | ... | @@ -42,6 +42,7 @@ func init() { |
| 42 | 42 | ||
| 43 | var ( | 43 | var ( |
| 44 | lastupdateFilename string = "lastupdate.tmp" | 44 | lastupdateFilename string = "lastupdate.tmp" |
| 45 | commentFilename string = "commentsRouter.go" | ||
| 45 | pkgLastupdate map[string]int64 | 46 | pkgLastupdate map[string]int64 |
| 46 | genInfoList map[string][]ControllerComments | 47 | genInfoList map[string][]ControllerComments |
| 47 | ) | 48 | ) |
| ... | @@ -52,6 +53,7 @@ func init() { | ... | @@ -52,6 +53,7 @@ func init() { |
| 52 | } | 53 | } |
| 53 | 54 | ||
| 54 | func parserPkg(pkgRealpath, pkgpath string) error { | 55 | func parserPkg(pkgRealpath, pkgpath string) error { |
| 56 | commentFilename = strings.Replace(pkgpath, "/", "_", -1) + "_" + commentFilename | ||
| 55 | if !compareFile(pkgRealpath) { | 57 | if !compareFile(pkgRealpath) { |
| 56 | Info(pkgRealpath + " don't has updated") | 58 | Info(pkgRealpath + " don't has updated") |
| 57 | return nil | 59 | return nil |
| ... | @@ -155,7 +157,7 @@ func genRouterCode() { | ... | @@ -155,7 +157,7 @@ func genRouterCode() { |
| 155 | } | 157 | } |
| 156 | } | 158 | } |
| 157 | if globalinfo != "" { | 159 | if globalinfo != "" { |
| 158 | f, err := os.Create(path.Join(workPath, "routers", "commentsRouter.go")) | 160 | f, err := os.Create(path.Join(workPath, "routers", commentFilename)) |
| 159 | if err != nil { | 161 | if err != nil { |
| 160 | panic(err) | 162 | panic(err) |
| 161 | } | 163 | } |
| ... | @@ -165,7 +167,7 @@ func genRouterCode() { | ... | @@ -165,7 +167,7 @@ func genRouterCode() { |
| 165 | } | 167 | } |
| 166 | 168 | ||
| 167 | func compareFile(pkgRealpath string) bool { | 169 | func compareFile(pkgRealpath string) bool { |
| 168 | if !utils.FileExists(path.Join(workPath, "routers", "commentsRouter.go")) { | 170 | if !utils.FileExists(path.Join(workPath, "routers", commentFilename)) { |
| 169 | return true | 171 | return true |
| 170 | } | 172 | } |
| 171 | if utils.FileExists(path.Join(workPath, lastupdateFilename)) { | 173 | if utils.FileExists(path.Join(workPath, lastupdateFilename)) { | ... | ... |
-
Please register or sign in to post a comment