Go utilities for application development.
MetaError: Rich error context with stack traces, file locations, and CSV serializationMultiError: Aggregate multiple errorsDebugContext: Context with value inspection capabilitiesCloseWithLog: Resource cleanup with logging and retries- Application mode control (
ReleaseMode,DevMode,DebugMode) - Context utilities
MainContext: App-level context with signal handlingContextCancelled: Status checks
- Robustness helpers
SleepMinPlusRandom: Jittered delaysReturnTrueXPercentOfTime: Probabilistic execution
// Error handling with context
err := app.NewMetaError(errors.New("something failed"))
fmt.Printf("%+v\n", err) // Prints error with stack trace
// Multiple errors
mErr := app.NewMultiError(err1, err2)
if mErr.HasErrors() {
log.Fatal(mErr)
}
// Logging with context
defer app.LogSince("operation completed", time.Now())
// Resource cleanup
defer app.CloseWithLog(file, "file")go get github.com/mhpenta/app