This commit is contained in:
anqiansong
2021-05-13 18:42:05 +08:00
committed by GitHub
parent ea01cc78f0
commit 9f6a574f97
4 changed files with 37 additions and 16 deletions

View File

@@ -64,8 +64,13 @@ func (g *DefaultGenerator) GenMain(ctx DirContext, proto parser.Proto, cfg *conf
return err
}
etcFileName, err := format.FileNamingFormat(cfg.NamingFormat, ctx.GetServiceName().Source())
if err != nil {
return err
}
return util.With("main").GoFmt(true).Parse(text).SaveTo(map[string]interface{}{
"serviceName": strings.ToLower(ctx.GetServiceName().ToCamel()),
"serviceName": etcFileName,
"imports": strings.Join(imports, util.NL),
"pkg": proto.PbPackage,
"serviceNew": stringx.From(proto.Service.Name).ToCamel(),