bccdee 5 hours ago A fun quirk about Go that nobody tells you about is that a function with multiple return values can supply multiple arguments. So this: func must[T any](t T, err error) T { if err != nil { panic(err) } return t } func makeInt(i int) (int, error) { if i == 0 { return 0, fmt.Errorf("not zero") } return i, nil } func main() { i := must(makeInt(3)) } is totally legal & works exactly how you'd expect it to!
A fun quirk about Go that nobody tells you about is that a function with multiple return values can supply multiple arguments. So this:
is totally legal & works exactly how you'd expect it to!