修改序列化的projectName的判断
This commit is contained in:
parent
c0cbff775f
commit
4f231d545b
|
@ -923,7 +923,7 @@ func getAllServiceName() (result []string) {
|
|||
}
|
||||
|
||||
// 获取项目的参数
|
||||
func getServiceNameAndProjectName(dir string) (serviceName string, projectName string, projectLastName string) {
|
||||
func getServiceNameAndProjectName(dir string) (serviceName string, projectName string, goModeName string) {
|
||||
|
||||
ifile, err := ini.Load(dir + "/service_config.ini")
|
||||
if err != nil {
|
||||
|
@ -960,7 +960,18 @@ func getServiceNameAndProjectName(dir string) (serviceName string, projectName s
|
|||
}
|
||||
|
||||
paths := strings.Split(projectName, "/")
|
||||
projectLastName = paths[len(paths)-1]
|
||||
goModeName = paths[len(paths)-1]
|
||||
|
||||
moddata, err := os.ReadFile("go.mod")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
result := regexp.MustCompile(`module\s+([a-zA-Z_\-]+)`).FindAllStringSubmatch(string(moddata), 1)
|
||||
if len(result) == 0 {
|
||||
panic("无法找到go.mod 获取 module信息")
|
||||
}
|
||||
goModeName = result[0][1]
|
||||
|
||||
return
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"net/url"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var fusen *env.Fusen[config.Config]
|
||||
|
|
Loading…
Reference in New Issue
Block a user