1
0
mirror of https://github.com/beego/bee.git synced 2024-11-22 20:20:55 +00:00

Merge pull request #114 from lei-cao/master

Using local package name for renamed packages.
This commit is contained in:
astaxie 2015-05-14 17:55:28 +08:00
commit 146c3b9655

View File

@ -149,7 +149,11 @@ func generateDocs(curpath string) {
} }
} }
for _, im := range f.Imports { for _, im := range f.Imports {
analisyscontrollerPkg(im.Path.Value) localName := ""
if im.Name != nil {
localName = im.Name.Name
}
analisyscontrollerPkg(localName, im.Path.Value)
} }
for _, d := range f.Decls { for _, d := range f.Decls {
switch specDecl := d.(type) { switch specDecl := d.(type) {
@ -256,13 +260,17 @@ func analisysNSInclude(baseurl string, ce *ast.CallExpr) string {
return cname return cname
} }
func analisyscontrollerPkg(pkgpath string) { func analisyscontrollerPkg(localName, pkgpath string) {
pkgpath = strings.Trim(pkgpath, "\"") pkgpath = strings.Trim(pkgpath, "\"")
if isSystemPackage(pkgpath) { if isSystemPackage(pkgpath) {
return return
} }
pps := strings.Split(pkgpath, "/") if localName != "" {
importlist[pps[len(pps)-1]] = pkgpath importlist[localName] = pkgpath
} else {
pps := strings.Split(pkgpath, "/")
importlist[pps[len(pps)-1]] = pkgpath
}
if pkgpath == "github.com/astaxie/beego" { if pkgpath == "github.com/astaxie/beego" {
return return
} }