mirror of
https://github.com/beego/bee.git
synced 2024-11-21 23:50:54 +00:00
fix hard coding in router.go pkg import
This commit is contained in:
parent
f20b75c370
commit
233613eb16
@ -500,6 +500,8 @@ func writeRouterFile(tables []*Table, rPath string) {
|
|||||||
// add export controller
|
// add export controller
|
||||||
fpath := path.Join(rPath, "router.go")
|
fpath := path.Join(rPath, "router.go")
|
||||||
routerStr := strings.Replace(ROUTER_TPL, "{{nameSpaces}}", strings.Join(nameSpaces, ""), 1)
|
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)
|
f, err := os.OpenFile(fpath, os.O_CREATE|os.O_EXCL|os.O_RDWR, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ColorLog("[ERRO] %v\n", err)
|
ColorLog("[ERRO] %v\n", err)
|
||||||
@ -742,8 +744,7 @@ func (this *{{ctrlName}}Controller) Delete() {
|
|||||||
package routers
|
package routers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"api/controllers"
|
"{{projectName}}/controllers"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user