mirror of
https://github.com/go-gitea/gitea
synced 2025-08-06 17:48:19 +00:00
Run gopls modernize
on codebase (#34751)
Recent modernize fixes: https://github.com/golang/tools/commits/master/gopls/internal/analysis/modernize
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
"maps"
|
||||
"reflect"
|
||||
"sync"
|
||||
texttemplate "text/template"
|
||||
@@ -40,9 +41,7 @@ func (t *ScopedTemplate) Funcs(funcMap template.FuncMap) {
|
||||
panic("cannot add new functions to frozen template set")
|
||||
}
|
||||
t.all.Funcs(funcMap)
|
||||
for k, v := range funcMap {
|
||||
t.parseFuncs[k] = v
|
||||
}
|
||||
maps.Copy(t.parseFuncs, funcMap)
|
||||
}
|
||||
|
||||
func (t *ScopedTemplate) New(name string) *template.Template {
|
||||
@@ -159,9 +158,7 @@ func newScopedTemplateSet(all *template.Template, name string) (*scopedTemplateS
|
||||
|
||||
textTmplPtr.muFuncs.Lock()
|
||||
ts.execFuncs = map[string]reflect.Value{}
|
||||
for k, v := range textTmplPtr.execFuncs {
|
||||
ts.execFuncs[k] = v
|
||||
}
|
||||
maps.Copy(ts.execFuncs, textTmplPtr.execFuncs)
|
||||
textTmplPtr.muFuncs.Unlock()
|
||||
|
||||
var collectTemplates func(nodes []parse.Node)
|
||||
@@ -220,9 +217,7 @@ func (ts *scopedTemplateSet) newExecutor(funcMap map[string]any) TemplateExecuto
|
||||
tmpl := texttemplate.New("")
|
||||
tmplPtr := ptr[textTemplate](tmpl)
|
||||
tmplPtr.execFuncs = map[string]reflect.Value{}
|
||||
for k, v := range ts.execFuncs {
|
||||
tmplPtr.execFuncs[k] = v
|
||||
}
|
||||
maps.Copy(tmplPtr.execFuncs, ts.execFuncs)
|
||||
if funcMap != nil {
|
||||
tmpl.Funcs(funcMap)
|
||||
}
|
||||
|
Reference in New Issue
Block a user