mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-30 14:52:30 -05:00
[chore] update go dependencies (#4304)
- github.com/KimMachineGun/automemlimit v0.7.2 => v0.7.3
- github.com/gin-contrib/cors v1.7.5 => v1.7.6
- github.com/minio/minio-go/v7 v7.0.92 => v7.0.94
- github.com/spf13/cast v1.8.0 => v1.9.2
- github.com/uptrace/bun{,/*} v1.2.11 => v1.2.14
- golang.org/x/image v0.27.0 => v0.28.0
- golang.org/x/net v0.40.0 => v0.41.0
- code.superseriousbusiness.org/go-swagger v0.31.0-gts-go1.23-fix => v0.32.3-gts-go1.23-fix
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4304
Co-authored-by: kim <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
7712885038
commit
8b0ea56027
294 changed files with 139999 additions and 21873 deletions
69
vendor/github.com/spf13/cast/alias.go
generated
vendored
Normal file
69
vendor/github.com/spf13/cast/alias.go
generated
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
// Copyright © 2014 Steve Francia <spf@spf13.com>.
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
package cast
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"slices"
|
||||
)
|
||||
|
||||
var kindNames = []string{
|
||||
reflect.String: "string",
|
||||
reflect.Bool: "bool",
|
||||
reflect.Int: "int",
|
||||
reflect.Int8: "int8",
|
||||
reflect.Int16: "int16",
|
||||
reflect.Int32: "int32",
|
||||
reflect.Int64: "int64",
|
||||
reflect.Uint: "uint",
|
||||
reflect.Uint8: "uint8",
|
||||
reflect.Uint16: "uint16",
|
||||
reflect.Uint32: "uint32",
|
||||
reflect.Uint64: "uint64",
|
||||
reflect.Float32: "float32",
|
||||
reflect.Float64: "float64",
|
||||
}
|
||||
|
||||
var kinds = map[reflect.Kind]func(reflect.Value) any{
|
||||
reflect.String: func(v reflect.Value) any { return v.String() },
|
||||
reflect.Bool: func(v reflect.Value) any { return v.Bool() },
|
||||
reflect.Int: func(v reflect.Value) any { return int(v.Int()) },
|
||||
reflect.Int8: func(v reflect.Value) any { return int8(v.Int()) },
|
||||
reflect.Int16: func(v reflect.Value) any { return int16(v.Int()) },
|
||||
reflect.Int32: func(v reflect.Value) any { return int32(v.Int()) },
|
||||
reflect.Int64: func(v reflect.Value) any { return v.Int() },
|
||||
reflect.Uint: func(v reflect.Value) any { return uint(v.Uint()) },
|
||||
reflect.Uint8: func(v reflect.Value) any { return uint8(v.Uint()) },
|
||||
reflect.Uint16: func(v reflect.Value) any { return uint16(v.Uint()) },
|
||||
reflect.Uint32: func(v reflect.Value) any { return uint32(v.Uint()) },
|
||||
reflect.Uint64: func(v reflect.Value) any { return v.Uint() },
|
||||
reflect.Float32: func(v reflect.Value) any { return float32(v.Float()) },
|
||||
reflect.Float64: func(v reflect.Value) any { return v.Float() },
|
||||
}
|
||||
|
||||
// resolveAlias attempts to resolve a named type to its underlying basic type (if possible).
|
||||
//
|
||||
// Pointers are expected to be indirected by this point.
|
||||
func resolveAlias(i any) (any, bool) {
|
||||
if i == nil {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
t := reflect.TypeOf(i)
|
||||
|
||||
// Not a named type
|
||||
if t.Name() == "" || slices.Contains(kindNames, t.Name()) {
|
||||
return i, false
|
||||
}
|
||||
|
||||
resolve, ok := kinds[t.Kind()]
|
||||
if !ok { // Not a supported kind
|
||||
return i, false
|
||||
}
|
||||
|
||||
v := reflect.ValueOf(i)
|
||||
|
||||
return resolve(v), true
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue