mirror of
https://github.com/kemko/icecast-ripper.git
synced 2026-01-01 15:55:42 +03:00
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.20.1 to 1.21.0. - [Release notes](https://github.com/spf13/viper/releases) - [Commits](https://github.com/spf13/viper/compare/v1.20.1...v1.21.0) --- updated-dependencies: - dependency-name: github.com/spf13/viper dependency-version: 1.21.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
38 lines
826 B
Go
38 lines
826 B
Go
// 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"
|
|
)
|
|
|
|
// From html/template/content.go
|
|
// Copyright 2011 The Go Authors. All rights reserved.
|
|
// indirect returns the value, after dereferencing as many times
|
|
// as necessary to reach the base type (or nil).
|
|
func indirect(i any) (any, bool) {
|
|
if i == nil {
|
|
return nil, false
|
|
}
|
|
|
|
if t := reflect.TypeOf(i); t.Kind() != reflect.Ptr {
|
|
// Avoid creating a reflect.Value if it's not a pointer.
|
|
return i, false
|
|
}
|
|
|
|
v := reflect.ValueOf(i)
|
|
|
|
for v.Kind() == reflect.Ptr || (v.Kind() == reflect.Interface && v.Elem().Kind() == reflect.Ptr) {
|
|
if v.IsNil() {
|
|
return nil, true
|
|
}
|
|
|
|
v = v.Elem()
|
|
}
|
|
|
|
return v.Interface(), true
|
|
}
|