Skip to content

Commit

Permalink
add: 计算引入别名
Browse files Browse the repository at this point in the history
  • Loading branch information
cyz-home committed May 29, 2023
1 parent bf0c2cd commit db6d0c3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion parser/help_str.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ func GetImportStrForMap(m map[string]string) string {
func GenImportAlias(path, packageName string, m map[string]string) map[string]string {
aliasMapImport := make(map[string]string)
importMapAlias := make(map[string]string)
importCheck := make(map[string][]string)

keys := make([]string, 0)
for s, _ := range m {
Expand All @@ -471,8 +472,14 @@ func GenImportAlias(path, packageName string, m map[string]string) map[string]st
}
}
if key == packageName {
kk := len(importCheck[key])
if kk == 0 {
importCheck[key] = []string{}
}
if "/bootstrap/providers" != path {
aliasMapImport[key+"_2"] = imp
kkk := key + "_" + strconv.Itoa(kk)
aliasMapImport[kkk] = imp
importCheck[key] = append(importCheck[key], kkk)
}
} else {
aliasMapImport[key] = imp
Expand Down

0 comments on commit db6d0c3

Please sign in to comment.