refactor(pages): use maps.Copy in deepMergeArrays
Some checks failed
Build and Release / Create Release (push) Successful in 1s
Build and Release / Unit Tests (push) Successful in 3m22s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 7m53s
Build and Release / Lint (push) Successful in 9m1s
Build and Release / Build Binaries (arm64, darwin, macos) (push) Failing after 0s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Successful in 3m53s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Successful in 5m14s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Successful in 9h5m32s
Build and Release / Build Binary (linux/arm64) (push) Failing after 14m38s
Some checks failed
Build and Release / Create Release (push) Successful in 1s
Build and Release / Unit Tests (push) Successful in 3m22s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 7m53s
Build and Release / Lint (push) Successful in 9m1s
Build and Release / Build Binaries (arm64, darwin, macos) (push) Failing after 0s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Successful in 3m53s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Successful in 5m14s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Successful in 9h5m32s
Build and Release / Build Binary (linux/arm64) (push) Failing after 14m38s
Replace manual map copy loop with maps.Copy from Go 1.21 stdlib. Cleaner and potentially more efficient. Pre-allocates merged map with correct capacity.
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
|||||||
_ "image/jpeg" // register JPEG decoder for social card background images
|
_ "image/jpeg" // register JPEG decoder for social card background images
|
||||||
_ "image/png" // register PNG decoder for social card background images
|
_ "image/png" // register PNG decoder for social card background images
|
||||||
"io"
|
"io"
|
||||||
|
"maps"
|
||||||
"math/big"
|
"math/big"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
@@ -1106,10 +1107,8 @@ func deepMergeArrays(dst, src []any) []any {
|
|||||||
srcMap, srcIsMap := src[i].(map[string]any)
|
srcMap, srcIsMap := src[i].(map[string]any)
|
||||||
dstMap, dstIsMap := dst[i].(map[string]any)
|
dstMap, dstIsMap := dst[i].(map[string]any)
|
||||||
if srcIsMap && dstIsMap {
|
if srcIsMap && dstIsMap {
|
||||||
merged := make(map[string]any)
|
merged := make(map[string]any, len(dstMap))
|
||||||
for k, v := range dstMap {
|
maps.Copy(merged, dstMap)
|
||||||
merged[k] = v
|
|
||||||
}
|
|
||||||
result[i] = deepMerge(merged, srcMap)
|
result[i] = deepMerge(merged, srcMap)
|
||||||
} else {
|
} else {
|
||||||
result[i] = src[i]
|
result[i] = src[i]
|
||||||
|
|||||||
Reference in New Issue
Block a user