Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Tag is a compile-time variable Tag = "development" // Package is a compile-time variable Package = "gotui" // Commit is a compile-time variable Commit = "HEAD" // ReportsDir is a compile-time variable. // If left empty, debug helpers will use the return // of os.TempDir. ReportsDir = "" )
Functions ¶
func CapturePanicReport ¶
func CapturePanicReport(fn func())
CapturePanicReport captures a panic with CapturePanicReportWith, and exits or simply returns if there was no panic in fn. It uses the compile-time variables Tag, Package and ReportsDir, so make sure they're injected at compile-time when using this helper.
func CapturePanicReportWith ¶
func CapturePanicReportWith(dir, pkg, version string, run func()) ( panicValue any, err error, ok bool, )
CapturePanicReportWith captures a panic in fn and writes to disk a yaml report. The boolean value returned indicates if fn run with no panics. If the value is false, the returned string indicates the fs location of the report. An error is returned if there was a panic but the report couldn't be stored.
Types ¶
type Report ¶
type Report struct {
Package string
Version string
Author string
Subject string
Notes string
Build debug.BuildInfo `yaml:"build,omitempty"`
CreatedAt time.Time `yaml:"created_at,omitempty"`
UpdatedAt time.Time `yaml:"updated_at,omitempty"`
UpdatedBy string `yaml:"-"`
Closed bool `yaml:"closed,omitempty"`
ClosedAt time.Time `yaml:"closed_at,omitempty"`
Metadata map[string]string
}
Report contains information about a suspected or confirmed bug.
func BuildCrashReport ¶
BuildCrashReport builds a crash report with the given panic value, for the given package and version.