From 99424365deded1d79b22dab81804a03a7cc45c90 Mon Sep 17 00:00:00 2001 From: Nick Snyder Date: Sat, 27 Jan 2024 23:32:58 -0800 Subject: [PATCH] remove unused code --- v2/i18n/template_engine.go | 64 -------------------------------------- 1 file changed, 64 deletions(-) diff --git a/v2/i18n/template_engine.go b/v2/i18n/template_engine.go index 086b3e87..1a8c6cea 100644 --- a/v2/i18n/template_engine.go +++ b/v2/i18n/template_engine.go @@ -84,67 +84,3 @@ func (t *parsedTextTemplate) Execute(data any) (string, error) { } return buf.String(), nil } - -// type TemplateEngine interface { -// Execute(src string, data any) (string, error) -// } - -// type NoTemplateEngine struct{} - -// func (*NoTemplateEngine) Execute(src string, data any) (string, error) { -// return src, nil -// } - -// type TextTemplateEngine2 struct { -// LeftDelim string -// RightDelim string -// Funcs texttemplate.FuncMap -// Option string - -// cache map[string]*executeResult -// cacheMutex sync.RWMutex -// } - -// type executeResult struct { -// tmpl *texttemplate.Template -// err error -// } - -// func (t *TextTemplateEngine2) Execute(src string, data any) (string, error) { -// tmpl, err := t.getTemplate(src) -// if err != nil { -// return "", err -// } -// var buf bytes.Buffer -// if err := tmpl.Execute(&buf, data); err != nil { -// return "", err -// } -// return buf.String(), nil -// } - -// func (t *TextTemplateEngine2) getTemplate(template string) (*texttemplate.Template, error) { -// // It is not safe to use the cache if t.Funcs or t.Option is set. -// if t.Funcs != nil || t.Option != "" { -// return texttemplate.New("").Delims(t.LeftDelim, t.RightDelim).Funcs(t.Funcs).Option(t.Option).Parse(template) -// } - -// // If there is a cached result, return it. -// t.cacheMutex.RLock() -// result := t.cache[template] -// t.cacheMutex.RUnlock() -// if result != nil { -// return result.tmpl, result.err -// } - -// // Parse the template and save it to the cache -// tmpl, err := texttemplate.New("").Delims(t.LeftDelim, t.RightDelim).Parse(template) -// r := &executeResult{ -// tmpl: tmpl, -// err: err, -// } -// t.cacheMutex.Lock() -// t.cache[template] = r -// t.cacheMutex.Unlock() - -// return tmpl, err -// }