-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcustom.go
38 lines (30 loc) · 826 Bytes
/
custom.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"log"
"os"
)
func removeLondonTrips(countries []map[string]string) []map[string]string {
var filteredCountries []map[string]string
for _, trip := range countries {
if trip["place"] == "London" {
continue
}
filteredCountries = append(filteredCountries, trip)
}
return filteredCountries
}
func addScotlandTrip2023(countries []map[string]string) []map[string]string {
var filteredCountries []map[string]string
for _, trip := range countries {
if trip["name"] == "United Kingdom" {
trip["name"] = "Scotland"
}
filteredCountries = append(filteredCountries, trip)
}
return filteredCountries
}
func moveFile(fileName, filePath string) {
if err := os.Rename(fileName, filePath); err != nil {
log.Fatalf("unable to move %s to '%s'. Error: %v", fileName, filePath, err)
}
}