mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-08-22 17:46:48 +08:00
Refine must2 and apply NewAesGcm() to all usage (#5011)
* Refine must2 and apply NewAesGcm() to all usage * Remove unused package * Fix test
This commit is contained in:
@@ -23,7 +23,9 @@ func Must(err error) {
|
||||
}
|
||||
|
||||
// Must2 panics if the second parameter is not nil, otherwise returns the first parameter.
|
||||
func Must2(v interface{}, err error) interface{} {
|
||||
// This is useful when function returned "sth, err" and avoid many "if err != nil"
|
||||
// Internal usage only, if user input can cause err, it must be handled
|
||||
func Must2[T any](v T, err error) T {
|
||||
Must(err)
|
||||
return v
|
||||
}
|
||||
|
Reference in New Issue
Block a user