From c548123a3a17c47092d9a0831d7a3b818a3183cf Mon Sep 17 00:00:00 2001 From: Xinzhao Xu Date: Wed, 5 Jul 2023 10:58:40 +0800 Subject: [PATCH] Deprecate multiple functions since Go 1.21 --- array/array.go | 3 +++ maps/maps.go | 1 + 2 files changed, 4 insertions(+) diff --git a/array/array.go b/array/array.go index e623d7f..33b4145 100644 --- a/array/array.go +++ b/array/array.go @@ -5,6 +5,7 @@ import ( ) // ItemInArray returns true if an item is in the array. +// Deprecated: Use the built-in slices.Contains function instead func ItemInArray[Item comparable](item Item, items []Item) bool { for _, v := range items { if item == v { @@ -15,6 +16,7 @@ func ItemInArray[Item comparable](item Item, items []Item) bool { } // Min returns the smallest element in the array. +// Deprecated: Use the built-in min function instead func Min[Item constraints.Ordered](items ...Item) Item { min := items[0] for i := 1; i < len(items); i++ { @@ -26,6 +28,7 @@ func Min[Item constraints.Ordered](items ...Item) Item { } // Max returns the largest element in the array. +// Deprecated: Use the built-in max function instead func Max[Item constraints.Ordered](items ...Item) Item { max := items[0] for i := 1; i < len(items); i++ { diff --git a/maps/maps.go b/maps/maps.go index 8dd77ca..f63ac1d 100644 --- a/maps/maps.go +++ b/maps/maps.go @@ -1,6 +1,7 @@ package maps // DeepCopy returns a copy of the original map object. +// Deprecated: Use the built-in maps.Clone function instead func DeepCopy[K comparable, V any](src map[K]V) map[K]V { re := make(map[K]V, len(src)) for k, v := range src {