From 38d1bddeecf2ab4492cd1988824f38afe1cbb785 Mon Sep 17 00:00:00 2001 From: James Hamlin Date: Thu, 4 Jul 2024 12:50:13 -0700 Subject: [PATCH] Equals supports go maps and slices Signed-off-by: James Hamlin --- pkg/lang/equal.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/lang/equal.go b/pkg/lang/equal.go index eede11b..744bd88 100644 --- a/pkg/lang/equal.go +++ b/pkg/lang/equal.go @@ -15,6 +15,12 @@ func Equals(a, b any) bool { } return aVal.Pointer() == bVal.Pointer() } + if aVal.Kind() == reflect.Map || bVal.Kind() == reflect.Map || aVal.Kind() == reflect.Slice || bVal.Kind() == reflect.Slice { + if aVal.Kind() != bVal.Kind() { + return false + } + return Equals(Seq(a), Seq(b)) + } if a == b { return true