BetaBug修复 (#1825)

* feature:调整package注入路由方法

* feature:调整package回滚路由方法

* feature:调整创建自动化代码enter重复import的问题
This commit is contained in:
PiexlMax(奇淼
2024-07-22 23:53:48 +08:00
committed by GitHub
parent 5492e0db50
commit 39be2d0351
4 changed files with 123 additions and 171 deletions

View File

@@ -4,6 +4,7 @@ import (
"go/ast"
"go/token"
"io"
"strings"
)
type Import struct {
@@ -57,7 +58,7 @@ func (a *Import) Injection(file *ast.File) error {
}
for j := 0; j < len(v1.Specs); j++ {
v2, o2 := v1.Specs[j].(*ast.ImportSpec)
if o2 && v2.Path.Value == a.ImportPath {
if o2 && strings.Contains(a.ImportPath, v2.Path.Value) {
has = true
break
}