fix(middleware):add middleware format

This commit is contained in:
Sodesnei 2021-09-29 20:24:51 +08:00
parent 488d84580e
commit 2c6a6a6848
3 changed files with 12 additions and 11 deletions

View File

@ -1,5 +0,0 @@
package log_middle
func wait() {
}

View File

@ -1,7 +1,7 @@
package middle package middle
import middleConf "gitee.com/timedb/wheatCache/middleware/config" import getMiddlewareMap "gitee.com/timedb/wheatCache/middleware/config"
func init() { func Init() {
middleConf.GetMiddlewareMap() getMiddlewareMap.GetMiddlewareMap()
} }

View File

@ -51,17 +51,23 @@ def getMiddleDir(keys:list)->list:
dirs.append(middleware) dirs.append(middleware)
return dirs return dirs
def format_code_go():
go_fmt(f"{middlePath}/config/middle.gen.go")
def set_middle_server():
if __name__ == "__main__":
tem_text = load_template("middle.template") tem_text = load_template("middle.template")
temp = Template(tem_text) temp = Template(tem_text)
keys = getMiddleName(middlePath) keys = getMiddleName(middlePath)
dirs = getMiddleDir(keys) dirs = getMiddleDir(keys)
text = temp.render(dirs=dirs,) text = temp.render(dirs=dirs)
temp_path = f"{middlePath}/config/middle.gen.go" temp_path = f"{middlePath}/config/middle.gen.go"
with open(temp_path,'w',encoding='utf-8') as f: with open(temp_path,'w',encoding='utf-8') as f:
f.write(text) f.write(text)
if __name__ == "__main__":
set_middle_server()
format_code_go()