From 8ebda6fb3a42e1e164584c02d2145a873375f5cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Thu, 25 May 2023 18:20:31 +0200 Subject: [PATCH] v0.0.123 --- langext/maps.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/langext/maps.go b/langext/maps.go index 90bd322..c104490 100644 --- a/langext/maps.go +++ b/langext/maps.go @@ -47,3 +47,11 @@ func CopyMap[K comparable, V any](a map[K]V) map[K]V { } return result } + +func ForceMap[K comparable, V any](v map[K]V) map[K]V { + if v == nil { + return make(map[K]V, 0) + } else { + return v + } +}