Skip to content

Commit 47a556e

Browse files
committed
sunset MapKeys and MapValues
Signed-off-by: Ziv Nevo <nevo@il.ibm.com>
1 parent f967c95 commit 47a556e

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

pkg/common/genericSet.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (s GenericSet[T]) AsKey() SetAsKey {
4242
}
4343

4444
func (s GenericSet[T]) AsList() []T {
45-
return MapKeys(s)
45+
return slices.Collect(maps.Keys(s))
4646
}
4747

4848
func FromList[T comparable](l []T) GenericSet[T] {
@@ -76,10 +76,3 @@ func AnyMapEntry[K comparable, V any](m map[K]V) (k K, v V) {
7676
}
7777
return k, v
7878
}
79-
80-
func MapValues[K comparable, V any](m map[K]V) []V {
81-
return slices.Collect(maps.Values(m))
82-
}
83-
func MapKeys[K comparable, V any](m map[K]V) []K {
84-
return slices.Collect(maps.Keys(m))
85-
}

pkg/drawio/layout.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SPDX-License-Identifier: Apache-2.0
77
package drawio
88

99
import (
10+
"maps"
1011
"slices"
1112
"sort"
1213

@@ -466,7 +467,7 @@ func sortIconsBySGs(sgs []SquareTreeNodeInterface) [][]TreeNodeInterface {
466467
sgsToIcons[sgsAsKey] = append(sgsToIcons[sgsAsKey], icon)
467468
}
468469
// covert to list:
469-
return common.MapValues(sgsToIcons)
470+
return slices.Collect(maps.Values(sgsToIcons))
470471
}
471472

472473
// ///////////////////////////////////////////////////////////

pkg/linter/linterExecute.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ package linter
88

99
import (
1010
"fmt"
11+
"maps"
1112
"slices"
1213
"sort"
1314
"strings"
1415

15-
"github.com/np-guard/vpc-network-config-analyzer/pkg/common"
1616
"github.com/np-guard/vpc-network-config-analyzer/pkg/vpcmodel"
1717
)
1818

@@ -37,7 +37,7 @@ var linterGenerators = map[string]linterGenerator{
3737
}
3838

3939
func ValidLintersNames() string {
40-
return strings.Join(common.MapKeys(linterGenerators), ",")
40+
return strings.Join(slices.Collect(maps.Keys(linterGenerators)), ",")
4141
}
4242
func IsValidLintersNames(name string) bool {
4343
_, ok := linterGenerators[name]

0 commit comments

Comments
 (0)