mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-04 12:52:28 +08:00
test&doc: add example and update doc for xerror package
This commit is contained in:
@@ -6,6 +6,7 @@ package xerror
|
||||
|
||||
// Unwrap if err is nil then it returns a valid value
|
||||
// If err is not nil, Unwrap panics with err.
|
||||
// Play: https://go.dev/play/p/w84d7Mb3Afk
|
||||
func Unwrap[T any](val T, err error) T {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
Reference in New Issue
Block a user