Home / Function/ readNthLine() — gin Function Reference

readNthLine() — gin Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  ddf49568_106f_1468_f078_b070ac0d4774["readNthLine()"]
  fafa3f3c_1482_f023_f289_21663c39573c["stack()"]
  fafa3f3c_1482_f023_f289_21663c39573c -->|calls| ddf49568_106f_1468_f078_b070ac0d4774
  style ddf49568_106f_1468_f078_b070ac0d4774 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

recovery.go lines 146–169

func readNthLine(file string, n int) (string, error) {
	if n < 0 {
		return "", nil
	}

	f, err := os.Open(file)
	if err != nil {
		return "", err
	}
	defer f.Close()

	scanner := bufio.NewScanner(f)
	for i := 0; i < n; i++ {
		if !scanner.Scan() {
			return "", nil
		}
	}

	if scanner.Scan() {
		return strings.TrimSpace(scanner.Text()), nil
	}

	return "", nil
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does readNthLine() do?
readNthLine() is a function in the gin codebase.
What calls readNthLine()?
readNthLine() is called by 1 function(s): stack.

Analyze Your Own Codebase

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

Try Supermodel Free