mirror of
https://github.com/kubernetes/client-go.git
synced 2025-08-13 21:15:27 +00:00
Change reflect.Ptr to reflect.Pointer
Kubernetes-commit: df168d5b5c2dab7414fc00ead1a51257ec326a98
This commit is contained in:
parent
8dfe88aeff
commit
1b23c1577a
6
third_party/forked/golang/template/exec.go
vendored
6
third_party/forked/golang/template/exec.go
vendored
@ -17,7 +17,7 @@ var (
|
|||||||
// We indirect through pointers and empty interfaces (only) because
|
// We indirect through pointers and empty interfaces (only) because
|
||||||
// non-empty interfaces have methods we might need.
|
// non-empty interfaces have methods we might need.
|
||||||
func Indirect(v reflect.Value) (rv reflect.Value, isNil bool) {
|
func Indirect(v reflect.Value) (rv reflect.Value, isNil bool) {
|
||||||
for ; v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface; v = v.Elem() {
|
for ; v.Kind() == reflect.Pointer || v.Kind() == reflect.Interface; v = v.Elem() {
|
||||||
if v.IsNil() {
|
if v.IsNil() {
|
||||||
return v, true
|
return v, true
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ func Indirect(v reflect.Value) (rv reflect.Value, isNil bool) {
|
|||||||
// PrintableValue returns the, possibly indirected, interface value inside v that
|
// PrintableValue returns the, possibly indirected, interface value inside v that
|
||||||
// is best for a call to formatted printer.
|
// is best for a call to formatted printer.
|
||||||
func PrintableValue(v reflect.Value) (interface{}, bool) {
|
func PrintableValue(v reflect.Value) (interface{}, bool) {
|
||||||
if v.Kind() == reflect.Ptr {
|
if v.Kind() == reflect.Pointer {
|
||||||
v, _ = Indirect(v) // fmt.Fprint handles nil.
|
v, _ = Indirect(v) // fmt.Fprint handles nil.
|
||||||
}
|
}
|
||||||
if !v.IsValid() {
|
if !v.IsValid() {
|
||||||
@ -39,7 +39,7 @@ func PrintableValue(v reflect.Value) (interface{}, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !v.Type().Implements(errorType) && !v.Type().Implements(fmtStringerType) {
|
if !v.Type().Implements(errorType) && !v.Type().Implements(fmtStringerType) {
|
||||||
if v.CanAddr() && (reflect.PtrTo(v.Type()).Implements(errorType) || reflect.PtrTo(v.Type()).Implements(fmtStringerType)) {
|
if v.CanAddr() && (reflect.PointerTo(v.Type()).Implements(errorType) || reflect.PointerTo(v.Type()).Implements(fmtStringerType)) {
|
||||||
v = v.Addr()
|
v = v.Addr()
|
||||||
} else {
|
} else {
|
||||||
switch v.Kind() {
|
switch v.Kind() {
|
||||||
|
Loading…
Reference in New Issue
Block a user