package servicegen import ( "git.ouxuan.net/tommy/hasaki-ctl/servicegen/tpl" "path/filepath" "text/template" ) var ( apiTpl = CreateTpl("api.tpl") apiPreTpl = CreateTpl("api_pre.tpl") apiTaskTpl = CreateTpl("api_task.tpl") apiTestTpl = CreateTpl("api_test.tpl") dbModelTpl = CreateTpl("db_model.tpl") optionsTpl = CreateTpl("options.tpl") externalTpl = CreateTpl("external.tpl") configJsonTpl = CreateTpl("configjson.tpl") mainTpl = CreateTpl("main.tpl") initializeTpl = CreateTpl("initialize.tpl") adminInitializeTpl = CreateTpl("initialize_admin.tpl") ) func CreateTpl(filename string)*template.Template { body, err := tpl.Asset(filepath.Join("servicegen/tpl", filename)) if err != nil { panic(err) } return template.Must(template.New(filepath.Base(filename)).Parse(string(body))) }