Home / Function/ function() — gin Function Reference

function() — gin Function Reference

Architecture documentation for the function() function in recovery.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  2898a4e5_12e4_fbfc_3b19_8cb3017c8266["function()"]
  b2655a63_5a3e_56ca_c0dd_550d7efec3e6["recovery.go"]
  2898a4e5_12e4_fbfc_3b19_8cb3017c8266 -->|defined in| b2655a63_5a3e_56ca_c0dd_550d7efec3e6
  style 2898a4e5_12e4_fbfc_3b19_8cb3017c8266 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

recovery.go lines 172–194

func function(pc uintptr) string {
	fn := runtime.FuncForPC(pc)
	if fn == nil {
		return dunno
	}
	name := fn.Name()
	// The name includes the path name to the package, which is unnecessary
	// since the file name is already included.  Plus, it has center dots.
	// That is, we see
	//	runtime/debug.*T·ptrmethod
	// and want
	//	*T.ptrmethod
	// Also the package path might contain dot (e.g. code.google.com/...),
	// so first eliminate the path prefix
	if lastSlash := strings.LastIndexByte(name, '/'); lastSlash >= 0 {
		name = name[lastSlash+1:]
	}
	if period := strings.IndexByte(name, '.'); period >= 0 {
		name = name[period+1:]
	}
	name = strings.ReplaceAll(name, "·", ".")
	return name
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does function() do?
function() is a function in the gin codebase, defined in recovery.go.
Where is function() defined?
function() is defined in recovery.go at line 172.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free