mirror of
https://github.com/tailscale/tailscale.git
synced 2025-06-21 07:38:38 +00:00
util/must: add Get2 for functions that return two values
Updates #cleanup Signed-off-by: James Sanderson <jsanderson@tailscale.com>
This commit is contained in:
parent
3d6e1171c1
commit
735f15cb49
@ -23,3 +23,11 @@ func Get[T any](v T, err error) T {
|
|||||||
}
|
}
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get2 returns v1 and v2 as is. It panics if err is non-nil.
|
||||||
|
func Get2[T any, U any](v1 T, v2 U, err error) (T, U) {
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return v1, v2
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user