func createTrip(r map[string]string, routes map[string]*gtfs.Route, services map[string]*gtfs.Service, shapes map[string]*gtfs.Shape) *gtfs.Trip { a := new(gtfs.Trip) a.Id = getString("trip_id", r, true) if val, ok := routes[getString("route_id", r, true)]; ok { a.Route = val } else { panic(fmt.Sprintf("No route with id %s found", getString("route_id", r, true))) } if val, ok := services[getString("service_id", r, true)]; ok { a.Service = val } else { panic(fmt.Sprintf("No service with id %s found", getString("service_id", r, true))) } a.Headsign = getString("trip_headsign", r, false) a.Short_name = getString("trip_short_name", r, false) a.Direction_id = getInt("direction_id", r, false) a.Block_id = getString("block_id", r, false) shapeId := getString("shape_id", r, false) if len(shapeId) > 0 { if val, ok := shapes[shapeId]; ok { a.Shape = val } else { panic(fmt.Sprintf("No shape with id %s found", shapeId)) } } a.Wheelchair_accessible = getInt("wheelchair_accessible", r, false) a.Bikes_allowed = getInt("bikes_allowed", r, false) return a }