runtime

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Caller

func Caller(skip int) (shortName, fullName, file string, line int, ok bool)
Example
package main

import (
	"fmt"

	"github.com/foomo/go/runtime"
)

func main() {
	shortName, fullName, file, line, ok := runtime.Caller(0)

	fmt.Println(shortName)
	fmt.Println(fullName)
	fmt.Println(file)
	fmt.Println(line)
	fmt.Println(ok)

}
Output:
runtime_test.ExampleCaller
github.com/foomo/go/runtime_test.ExampleCaller
runtime/caller_test.go
18
true

func StackTrace

func StackTrace(size, skip int) string

StackTrace captures and formats a stack trace up to the specified number of frames, skipping the given number of initial frames.

Example
package main

import (
	"fmt"

	"github.com/foomo/go/runtime"
)

func main() {
	stack := runtime.StackTrace(2, 0)

	fmt.Println(stack)

}
Output:
github.com/foomo/go/runtime_test.ExampleStackTrace
  runtime/stacktrace_test.go:13
testing.runExample
  testing/run_example.go:63

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL