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).
(i any)
| 14 | // indirect returns the value, after dereferencing as many times |
| 15 | // as necessary to reach the base type (or nil). |
| 16 | func indirect(i any) (any, bool) { |
| 17 | if i == nil { |
| 18 | return nil, false |
| 19 | } |
| 20 | |
| 21 | if t := reflect.TypeOf(i); t.Kind() != reflect.Ptr { |
| 22 | // Avoid creating a reflect.Value if it's not a pointer. |
| 23 | return i, false |
| 24 | } |
| 25 | |
| 26 | v := reflect.ValueOf(i) |
| 27 | |
| 28 | for v.Kind() == reflect.Ptr || (v.Kind() == reflect.Interface && v.Elem().Kind() == reflect.Ptr) { |
| 29 | if v.IsNil() { |
| 30 | return nil, true |
| 31 | } |
| 32 | |
| 33 | v = v.Elem() |
| 34 | } |
| 35 | |
| 36 | return v.Interface(), true |
| 37 | } |
no outgoing calls
searching dependent graphs…