getPkgPath extract the package path for a Go type. We'll do some extra work for typical types that did not get a name, for example *E has the package path of E.
(t reflect.Type)
| 274 | // extra work for typical types that did not get a name, for example |
| 275 | // *E has the package path of E. |
| 276 | func getPkgPath(t reflect.Type) string { |
| 277 | pkgPath := t.PkgPath() |
| 278 | if pkgPath != "" { |
| 279 | return pkgPath |
| 280 | } |
| 281 | // Try harder. |
| 282 | switch t.Kind() { |
| 283 | case reflect.Array, reflect.Chan, reflect.Map, reflect.Ptr, reflect.Slice: |
| 284 | return getPkgPath(t.Elem()) |
| 285 | } |
| 286 | // Nothing to report. |
| 287 | return "" |
| 288 | } |
| 289 | |
| 290 | // TypeKey identifies an error for the purpose of looking up decoders. |
| 291 | // It is equivalent to the "family name" in ErrorTypeMarker. |
no outgoing calls
no test coverage detected
searching dependent graphs…