all: gofmt -w -r 'interface{} -> any' .

Updates #9687
This commit is contained in:
Bjørn Erik Pedersen
2022-03-17 22:03:27 +01:00
parent 423594e03a
commit b80853de90
342 changed files with 2118 additions and 2102 deletions

View File

@@ -49,7 +49,7 @@ type TemplateFuncsNamespace struct {
Name string
// This is the method receiver.
Context func(v ...interface{}) (interface{}, error)
Context func(v ...any) (any, error)
// Additional info, aliases and examples, per method name.
MethodMappings map[string]TemplateFuncMethodMapping
@@ -59,7 +59,7 @@ type TemplateFuncsNamespace struct {
type TemplateFuncsNamespaces []*TemplateFuncsNamespace
// AddMethodMapping adds a method to a template function namespace.
func (t *TemplateFuncsNamespace) AddMethodMapping(m interface{}, aliases []string, examples [][2]string) {
func (t *TemplateFuncsNamespace) AddMethodMapping(m any, aliases []string, examples [][2]string) {
if t.MethodMappings == nil {
t.MethodMappings = make(map[string]TemplateFuncMethodMapping)
}
@@ -88,7 +88,7 @@ func (t *TemplateFuncsNamespace) AddMethodMapping(m interface{}, aliases []strin
// TemplateFuncMethodMapping represents a mapping of functions to methods for a
// given namespace.
type TemplateFuncMethodMapping struct {
Method interface{}
Method any
// Any template funcs aliases. This is mainly motivated by keeping
// backwards compatibility, but some new template funcs may also make
@@ -104,7 +104,7 @@ type TemplateFuncMethodMapping struct {
Examples [][2]string
}
func methodToName(m interface{}) string {
func methodToName(m any) string {
name := runtime.FuncForPC(reflect.ValueOf(m).Pointer()).Name()
name = filepath.Ext(name)
name = strings.TrimPrefix(name, ".")