update Must2

pull/876/head
Darien Raymond 2018-02-21 21:42:33 +01:00
parent 88b25d38cb
commit 098244530b
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 4 additions and 5 deletions

View File

@ -11,9 +11,8 @@ func Must(err error) {
} }
} }
// Must2 panics if the second parameter is not nil. // Must2 panics if the second parameter is not nil, otherwise returns the first parameter.
func Must2(v interface{}, err error) { func Must2(v interface{}, err error) interface{} {
if err != nil { Must(err)
panic(err) return v
}
} }