带下划线的项目,配置文件名字错误。 (#733)

master
lovelly 3 years ago committed by GitHub
parent 69935c1ba3
commit 33f87cf1f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -41,13 +41,14 @@ func main() {
func genMain(dir, rootPkg string, cfg *config.Config, api *spec.ApiSpec) error { func genMain(dir, rootPkg string, cfg *config.Config, api *spec.ApiSpec) error {
name := strings.ToLower(api.Service.Name) name := strings.ToLower(api.Service.Name)
if strings.HasSuffix(name, "-api") {
name = strings.ReplaceAll(name, "-api", "")
}
filename, err := format.FileNamingFormat(cfg.NamingFormat, name) filename, err := format.FileNamingFormat(cfg.NamingFormat, name)
if err != nil { if err != nil {
return err return err
} }
configName := filename
if strings.HasSuffix(filename, "-api") {
filename = strings.ReplaceAll(filename, "-api", "")
}
return genFile(fileGenConfig{ return genFile(fileGenConfig{
dir: dir, dir: dir,
@ -59,7 +60,7 @@ func genMain(dir, rootPkg string, cfg *config.Config, api *spec.ApiSpec) error {
builtinTemplate: mainTemplate, builtinTemplate: mainTemplate,
data: map[string]string{ data: map[string]string{
"importPackages": genMainImports(rootPkg), "importPackages": genMainImports(rootPkg),
"serviceName": api.Service.Name, "serviceName": configName,
}, },
}) })
} }

Loading…
Cancel
Save