1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
package try import ( "log" "git.thomasvoss.com/euro-cash.eu/pkg/atexit" ) func Try(e error) { if e != nil { atexit.Exec() log.Fatalln(e) } } func Try2[T any](x T, e error) T { Try(e) return x }