Skip to content

Commit

Permalink
use fixed size
Browse files Browse the repository at this point in the history
  • Loading branch information
David Wertenteil committed Aug 4, 2022
1 parent 439b288 commit 11fe657
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions str/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ func StringInSliceCaseInsensitive(strSlice []string, str string) bool {

// MapStringToSlice returns map's keys
func MapStringToSlice(strMap map[string]interface{}) []string {
strSlice := []string{}
strSlice := make([]string, len(strMap))
i := 0
for k := range strMap {
strSlice = append(strSlice, k)
strSlice[i] = k
i++
}
return strSlice
}
Expand Down

0 comments on commit 11fe657

Please sign in to comment.