498b235461
Build and test / Build and test AMD64 Ubuntu 22.04 (push) Failing after 0s
Publish Builder / amazonlinux2023 (push) Failing after 1s
Build and test / UT for Go (push) Has been skipped
Publish KRTE Images / KRTE (push) Failing after 1s
Build and test / Integration Test (push) Has been skipped
Build and test / Upload Code Coverage (push) Has been skipped
Publish Builder / rockylinux9 (push) Failing after 1s
Publish Builder / ubuntu22.04 (push) Failing after 0s
Publish Builder / ubuntu24.04 (push) Failing after 0s
Publish Gpu Builder / publish-gpu-builder (push) Failing after 1s
Publish Test Images / PyTest (push) Failing after 0s
Build and test / UT for Cpp (push) Has been cancelled
28 lines
512 B
Go
28 lines
512 B
Go
package common
|
|
|
|
// MapEqual compares two maps for equality
|
|
func MapEqual[K comparable, V comparable](m1, m2 map[K]V) bool {
|
|
if len(m1) != len(m2) {
|
|
return false
|
|
}
|
|
for k, v1 := range m1 {
|
|
v2, exist := m2[k]
|
|
if !exist || v1 != v2 {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
|
|
// CloneMap clones a map with comparable keys
|
|
func CloneMap[K comparable, V any](m map[K]V) map[K]V {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
clone := make(map[K]V, len(m))
|
|
for key, value := range m {
|
|
clone[key] = value
|
|
}
|
|
return clone
|
|
}
|