Slices, Maps
Declaring Empty Slices
var t []stringt := []string{}Copying Slices and Maps
// BAD
func (d *Driver) SetTrips(trips []Trip) {
d.trips = trips
}
trips := ...
d1.SetTrips(trips)
// Did you mean to modify d1.trips?
trips[0] = ...Returning Slices and Maps
Don't create new variables with append
Last updated