diff options
| author | 2023-06-05 10:15:05 +0200 | |
|---|---|---|
| committer | 2023-06-05 10:15:05 +0200 | |
| commit | b401bd1ccbce7fa547c75e9f0ae89e211112c1bb (patch) | |
| tree | 08bf9ed438713e8c390ea60732e7dfc14b0d3191 /vendor/github.com/spf13/cast/caste.go | |
| parent | [chore]: Bump github.com/minio/minio-go/v7 from 7.0.55 to 7.0.56 (#1869) (diff) | |
| download | gotosocial-b401bd1ccbce7fa547c75e9f0ae89e211112c1bb.tar.xz | |
[chore] update latest deps, ensure readme up to date (#1873)
* [chore] update latest deps, ensure readme up to date
* remove double entry
Diffstat (limited to 'vendor/github.com/spf13/cast/caste.go')
| -rw-r--r-- | vendor/github.com/spf13/cast/caste.go | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/vendor/github.com/spf13/cast/caste.go b/vendor/github.com/spf13/cast/caste.go index 514d759bf..d49bbf83e 100644 --- a/vendor/github.com/spf13/cast/caste.go +++ b/vendor/github.com/spf13/cast/caste.go @@ -98,10 +98,31 @@ func ToBoolE(i interface{}) (bool, error) { case nil: return false, nil case int: - if i.(int) != 0 { - return true, nil - } - return false, nil + return b != 0, nil + case int64: + return b != 0, nil + case int32: + return b != 0, nil + case int16: + return b != 0, nil + case int8: + return b != 0, nil + case uint: + return b != 0, nil + case uint64: + return b != 0, nil + case uint32: + return b != 0, nil + case uint16: + return b != 0, nil + case uint8: + return b != 0, nil + case float64: + return b != 0, nil + case float32: + return b != 0, nil + case time.Duration: + return b != 0, nil case string: return strconv.ParseBool(i.(string)) case json.Number: @@ -1385,6 +1406,8 @@ func (f timeFormat) hasTimezone() bool { var ( timeFormats = []timeFormat{ + // Keep common formats at the top. + {"2006-01-02", timeFormatNoTimezone}, {time.RFC3339, timeFormatNumericTimezone}, {"2006-01-02T15:04:05", timeFormatNoTimezone}, // iso8601 without timezone {time.RFC1123Z, timeFormatNumericTimezone}, @@ -1400,7 +1423,6 @@ var ( {time.UnixDate, timeFormatNamedTimezone}, {time.RubyDate, timeFormatNumericTimezone}, {"2006-01-02 15:04:05Z07:00", timeFormatNumericTimezone}, - {"2006-01-02", timeFormatNoTimezone}, {"02 Jan 2006", timeFormatNoTimezone}, {"2006-01-02 15:04:05 -07:00", timeFormatNumericTimezone}, {"2006-01-02 15:04:05 -0700", timeFormatNumericTimezone}, |
