func process[T any](value T, err error) {
if err != nil {
// handle error
}
// handle value
}
this can be used in cases such as control loops, to centralize error handling for multiple separate functions, instead of writing out the error handling separately for each function. for {
process(fetchFoo(ctx))
process(fetchBar(ctx))
}
k9s (k9scli.io) supports this directly.