refactor: use maps.Copy for cleaner map handling
Signed-off-by: xinhangzhou <shuangcui@aliyun.com>
This commit is contained in:
1 parent
5235f3b24f
commit
b7e3c20383
7 files changed
+18
-28
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"maps"
|
||||
"sort"
|
||||
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
@@ -94,13 +95,8 @@ func (c CustomRecords) Copy() CustomRecords {
|
||||
// records will be used.
|
||||
func (c CustomRecords) MergedCopy(other CustomRecords) CustomRecords {
|
||||
copiedRecords := make(CustomRecords, len(c))
|
||||
for k, v := range c {
|
||||
copiedRecords[k] = v
|
||||
}
|
||||
|
||||
for k, v := range other {
|
||||
copiedRecords[k] = v
|
||||
}
|
||||
maps.Copy(copiedRecords, c)
|
||||
maps.Copy(copiedRecords, other)
|
||||
|
||||
return copiedRecords
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user