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

@@ -38,7 +38,7 @@ type Namespace struct{}
// Example: "my-first-post" -> "My first post"
// Example: "103" -> "103rd"
// Example: 52 -> "52nd"
func (ns *Namespace) Humanize(in interface{}) (string, error) {
func (ns *Namespace) Humanize(in any) (string, error) {
word, err := cast.ToStringE(in)
if err != nil {
return "", err
@@ -59,7 +59,7 @@ func (ns *Namespace) Humanize(in interface{}) (string, error) {
}
// Pluralize returns the plural form of a single word.
func (ns *Namespace) Pluralize(in interface{}) (string, error) {
func (ns *Namespace) Pluralize(in any) (string, error) {
word, err := cast.ToStringE(in)
if err != nil {
return "", err
@@ -69,7 +69,7 @@ func (ns *Namespace) Pluralize(in interface{}) (string, error) {
}
// Singularize returns the singular form of a single word.
func (ns *Namespace) Singularize(in interface{}) (string, error) {
func (ns *Namespace) Singularize(in any) (string, error) {
word, err := cast.ToStringE(in)
if err != nil {
return "", err

View File

@@ -13,9 +13,9 @@ func TestInflect(t *testing.T) {
ns := New()
for _, test := range []struct {
fn func(i interface{}) (string, error)
in interface{}
expect interface{}
fn func(i any) (string, error)
in any
expect any
}{
{ns.Humanize, "MyCamel", "My camel"},
{ns.Humanize, "óbito", "Óbito"},

View File

@@ -26,7 +26,7 @@ func init() {
ns := &internal.TemplateFuncsNamespace{
Name: name,
Context: func(args ...interface{}) (interface{}, error) { return ctx, nil },
Context: func(args ...any) (any, error) { return ctx, nil },
}
ns.AddMethodMapping(ctx.Humanize,