From c501d1dcd1a289a8d6034434239b5dce71d22765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=88=E5=AD=A3=E8=8A=B1=E4=B8=AD=E7=9A=84=E6=98=9F?= =?UTF-8?q?=E8=BE=B0?= Date: Sat, 15 Jan 2022 11:52:32 +0000 Subject: [PATCH] Update tmpl.go --- tmpl.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tmpl.go b/tmpl.go index ef86bc2..9f1185e 100644 --- a/tmpl.go +++ b/tmpl.go @@ -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)