21
0
Fork 0

v0.0.379
Build Docker and Deploy / Run goext test-suite (push) Successful in 2m57s Details

This commit is contained in:
Mike Schwörer 2024-01-19 17:30:20 +01:00
parent b9e9575b9b
commit b9d0348735
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 23 additions and 2 deletions

View File

@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.378"
const GoextVersion = "0.0.379"
const GoextVersionTimestamp = "2024-01-16T15:04:10+0100"
const GoextVersionTimestamp = "2024-01-19T17:30:20+0100"

21
langext/must.go Normal file
View File

@ -0,0 +1,21 @@
package langext
// Must returns a value and panics on error
//
// Usage: Must(methodWithError(...))
func Must[T any](v T, err error) T {
if err != nil {
panic(err)
}
return v
}
// MustBool returns a value and panics on missing
//
// Usage: MustBool(methodWithOkayReturn(...))
func MustBool[T any](v T, ok bool) T {
if !ok {
panic("not ok")
}
return v
}