From 35837fc136eec6468e77db0c59a83cda53559a87 Mon Sep 17 00:00:00 2001 From: yanzuoguang Date: Sun, 9 Nov 2025 15:49:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(templates):=E4=BF=AE=E5=A4=8D=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E5=8A=A0=E8=BD=BD=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 ParseGlob 方法后添加错误检查 - 打印详细的错误信息以便调试- 确保在发生错误时函数能正确返回 --- .../platform/templates/template_loader.go | 6 ++++-- 32-platform/sportsstore/store.db | Bin 20480 -> 20480 bytes 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/32-platform/platform/templates/template_loader.go b/32-platform/platform/templates/template_loader.go index b48c564..6d3011b 100644 --- a/32-platform/platform/templates/template_loader.go +++ b/32-platform/platform/templates/template_loader.go @@ -22,9 +22,7 @@ func LoadTemplates(c config.Configuration) (err error) { fmt.Printf("设置模板 getTemplates 函数开始\n") doLoad := func() (t *template.Template) { - fmt.Printf("设置模板 getTemplates doLoad 函数已执行\n") - t = template.New("htmlTemplates") t.Funcs(map[string]interface{}{ "body": func() string { return "" }, @@ -32,6 +30,10 @@ func LoadTemplates(c config.Configuration) (err error) { "handler": func() interface{} { return "" }, }) t, err = t.ParseGlob(path) + if err != nil { + fmt.Printf("获取模板 getTemplates doLoad %v 错误: %v \n", path, err) + return + } return } diff --git a/32-platform/sportsstore/store.db b/32-platform/sportsstore/store.db index 8ba1aa259222159a417eb3d7050c68d5a92d9f40..c6cbafbbd6ff12761a5e9223dc72fb83ad1451ad 100644 GIT binary patch delta 91 zcmZozz}T>Wae}nqPX-1CRv?CfWfOIb8Gmj};OAjv*<8S*#l*6Cc}VL4h~Co7wdKF>YpY_`?qXm0T41 delta 91 zcmZozz}T>Wae}nqTLuOORv?Cfc@uSv8Q*S9;OAjv-dw<=#l*<6c{X3BpcoVX1_u6X jKmwwkg|CdyiH~iwpuij6&1`o67#FiB2yA9?_`?qXi>wse