aboutsummaryrefslogtreecommitdiff
path: root/util.go
blob: d6f1985b60d0c72aae4a5d8b19c78365760fa969 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// SPDX-FileCopyrightText: © 2022 Grégoire Duchêne <gduchene@awhk.org>
// SPDX-License-Identifier: ISC

package core

// Must panics if err is not nil. It returns val otherwise.
func Must[T any](val T, err error) T {
	if err != nil {
		panic(err)
	}
	return val
}