diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2025-05-25 09:31:58 +0100 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2025-05-25 09:31:58 +0100 |
| commit | bca1b0ccdece7b992cc88712aca36a9a127b1381 (patch) | |
| tree | a91d7028610d66c8f8f52bde5bbb3aeb41c3ff1f /util.go | |
| parent | 64fe7a6ad302af4d9b35c86f262c4ff41ed980fd (diff) | |
Use modern APIs and retire MapKeys
Diffstat (limited to 'util.go')
| -rw-r--r-- | util.go | 14 |
1 files changed, 0 insertions, 14 deletions
@@ -3,20 +3,6 @@ package core -// MapKeys returns a slice containing all the keys of the map supplied. -// It basically is https://pkg.go.dev/golang.org/x/exp/maps#Keys, but -// that package is still unstable. -func MapKeys[T ~map[K]V, K comparable, V any](m T) []K { - if len(m) == 0 { - return nil - } - ret := make([]K, 0, len(m)) - for k := range m { - ret = append(ret, k) - } - return ret -} - // Must panics if err is not nil. It returns val otherwise. func Must[T any](val T, err error) T { if err != nil { |
