Update tmpl.go

This commit is contained in:
kuoi 2022-01-15 11:52:32 +00:00 committed by GitHub
parent 0faf844242
commit c501d1dcd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,6 +16,7 @@ func do_impl(last_data tmpl_data) {
}
// 读取模板
// read the template
nex_tmpl, err := template.New("nex").Parse(string(f))
if err != nil {
fmt.Println("[ tmpl err ]", err)
@ -23,6 +24,7 @@ func do_impl(last_data tmpl_data) {
}
// 覆盖创建要写入的 nex 文件
// create the output nex file
new_file, err := os.OpenFile(file_output, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0666)
if err != nil {
fmt.Println("[ create or open file error ]", err)
@ -31,6 +33,7 @@ func do_impl(last_data tmpl_data) {
defer new_file.Close()
// 写入 nex 模板
// write the nex data
err = nex_tmpl.Execute(new_file, last_data)
if err != nil {
fmt.Println("[ err at tmpl exec ]", err)