I have this function to read a JSON file into a Driver struct:
func getDrivers() []Driver {
raw, err := ioutil.ReadFile("/home/ubuntu/drivers.json")
if err != nil {
fmt.Println(err.Error())
os.Exit(1)
}
var d []Driver
json.Unmarshal(raw, &d)
return d
}
How can I change this function to also work with a Pilot struct? I tried using []interface{} without success.
Thank you