Skip to content
This repository has been archived by the owner on Jul 6, 2022. It is now read-only.

Commit

Permalink
fix: fix bug with replace from slice function
Browse files Browse the repository at this point in the history
  • Loading branch information
eze-kiel committed Jun 3, 2022
1 parent df4cc52 commit 65d83ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,14 @@ func GetClosestCityName(name string) string {

// RemoveFromSliceOrdered removes a string from a slice and keep the order
func RemoveFromSliceOrdered(slice []string, s string) []string {
sl := slice
var idx int
for i, v := range slice {
for i, v := range sl {
if v == s {
idx = i
}
}
return append(slice[:idx], slice[idx+1:]...)
return append(sl[:idx], sl[idx+1:]...)
}

// this init function reads and loads the file containing all the cities.
Expand Down

0 comments on commit 65d83ca

Please sign in to comment.