MCPcopy Index your code
hub / github.com/cockroachdb/errors / getPkgPath

Function getPkgPath

errbase/encode.go:276–288  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

274// extra work for typical types that did not get a name, for example
275// *E has the package path of E.
276func 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.

Callers 1

getFullTypeNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…