mirror of
https://gitee.com/johng/gf
synced 2026-06-07 10:22:11 +08:00
@ -324,6 +324,10 @@ func (c CGenService) checkAndUpdateMain(srcFolder string) (err error) {
|
||||
mainFilePath = gfile.Join(gfile.Dir(gfile.Dir(gfile.Dir(logicFilePath))), "main.go")
|
||||
mainFileContent = gfile.GetContents(mainFilePath)
|
||||
)
|
||||
// No main content found.
|
||||
if mainFileContent == "" {
|
||||
return nil
|
||||
}
|
||||
if gstr.Contains(mainFileContent, importStr) {
|
||||
return nil
|
||||
}
|
||||
@ -331,6 +335,10 @@ func (c CGenService) checkAndUpdateMain(srcFolder string) (err error) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// No match.
|
||||
if len(match) < 2 {
|
||||
return nil
|
||||
}
|
||||
lines := garray.NewStrArrayFrom(gstr.Split(match[1], "\n"))
|
||||
for i, line := range lines.Slice() {
|
||||
line = gstr.Trim(line)
|
||||
|
||||
Reference in New Issue
Block a user