mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-11 08:12:26 +08:00
Pre-allocate memory to reduce the number of allocations (#272)
This commit is contained in:
@@ -34,7 +34,7 @@ func Wrap(cause error, message ...any) *XError {
|
||||
err := newXError()
|
||||
|
||||
if len(message) > 0 {
|
||||
var newMsgs []string
|
||||
newMsgs := make([]string, 0, len(message))
|
||||
for _, m := range message {
|
||||
newMsgs = append(newMsgs, fmt.Sprintf("%v", m))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user