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

fix hard coding in router.go pkg import

This commit is contained in:
ZhengYang 2014-08-04 13:54:37 +08:00
parent f20b75c370
commit 233613eb16

View File

@ -500,6 +500,8 @@ func writeRouterFile(tables []*Table, rPath string) {
// add export controller
fpath := path.Join(rPath, "router.go")
routerStr := strings.Replace(ROUTER_TPL, "{{nameSpaces}}", strings.Join(nameSpaces, ""), 1)
_, projectName := path.Split(path.Dir(rPath))
routerStr = strings.Replace(routerStr, "{{projectName}}", projectName, 1)
f, err := os.OpenFile(fpath, os.O_CREATE|os.O_EXCL|os.O_RDWR, 0666)
if err != nil {
ColorLog("[ERRO] %v\n", err)
@ -742,8 +744,7 @@ func (this *{{ctrlName}}Controller) Delete() {
package routers
import (
"api/controllers"
"{{projectName}}/controllers"
"github.com/astaxie/beego"
)