Skip to content

Commit

Permalink
Merge pull request #11 from iawia002/deprecated
Browse files Browse the repository at this point in the history
Deprecate multiple functions since Go 1.21
  • Loading branch information
iawia002 authored Jul 5, 2023
2 parents 41f1163 + c548123 commit 5c9f25c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions array/array.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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++ {
Expand All @@ -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++ {
Expand Down
1 change: 1 addition & 0 deletions maps/maps.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit 5c9f25c

Please sign in to comment.