Home / Function/ stack() — gin Function Reference

stack() — gin Function Reference

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

Function go GinCore Middleware calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  d45c1ff3_74e9_75f8_35fd_779a5973b503["stack()"]
  b2655a63_5a3e_56ca_c0dd_550d7efec3e6["recovery.go"]
  d45c1ff3_74e9_75f8_35fd_779a5973b503 -->|defined in| b2655a63_5a3e_56ca_c0dd_550d7efec3e6
  9b707d02_bf2d_b689_b041_4d275fda4cdd["CustomRecoveryWithWriter()"]
  9b707d02_bf2d_b689_b041_4d275fda4cdd -->|calls| d45c1ff3_74e9_75f8_35fd_779a5973b503
  70f5835e_2b3d_5cc0_4142_f3d09fba5a48["readNthLine()"]
  d45c1ff3_74e9_75f8_35fd_779a5973b503 -->|calls| 70f5835e_2b3d_5cc0_4142_f3d09fba5a48
  style d45c1ff3_74e9_75f8_35fd_779a5973b503 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

recovery.go lines 114–140

func stack(skip int) []byte {
	buf := new(bytes.Buffer) // the returned data
	// As we loop, we open files and read them. These variables record the currently
	// loaded file.
	var (
		nLine    string
		lastFile string
		err      error
	)
	for i := skip; ; i++ { // Skip the expected number of frames
		pc, file, line, ok := runtime.Caller(i)
		if !ok {
			break
		}
		// Print this much at least.  If we can't find the source, it won't show.
		fmt.Fprintf(buf, "%s:%d (0x%x)\n", file, line, pc)
		if file != lastFile {
			nLine, err = readNthLine(file, line-1)
			if err != nil {
				continue
			}
			lastFile = file
		}
		fmt.Fprintf(buf, "\t%s: %s\n", function(pc), cmp.Or(nLine, dunno))
	}
	return buf.Bytes()
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does stack() do?
stack() is a function in the gin codebase, defined in recovery.go.
Where is stack() defined?
stack() is defined in recovery.go at line 114.
What does stack() call?
stack() calls 1 function(s): readNthLine.
What calls stack()?
stack() is called by 1 function(s): CustomRecoveryWithWriter.

Analyze Your Own Codebase

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

Try Supermodel Free