Go:HTML 註解神秘消失 在你的Go Web 應用程式中,你注意到HTML 註解"}} 實作 func main() { t := template.Must(template.New("").Funcs(template.FuncMap{ "safe": func(s string) template.HTML { return template.HTML(s) }, }).Parse(src)) t.Execute(os.Stdout, nil) } const src = ` {{safe ""}} Some HTML content ` 輸出 Some HTML content 輸出 輸出 轉義HTML 註解中的引號以防止語法錯誤。 避免條件 HTML 註解以確保轉義一致。