types: don't use a private field
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Ask Bjørn Hansen 2025-01-12 01:34:08 -08:00
parent 15bc706d7a
commit c56a9b206c

View File

@ -12,8 +12,6 @@ type Airport struct {
Code string Code string
Distance float64 Distance float64
Type string Type string
data *alphafoxtrot.Airport
} }
func NewAirport(airport *alphafoxtrot.Airport) *Airport { func NewAirport(airport *alphafoxtrot.Airport) *Airport {
@ -23,7 +21,6 @@ func NewAirport(airport *alphafoxtrot.Airport) *Airport {
Name: airport.Name, Name: airport.Name,
Code: code, Code: code,
Type: airport.Type, Type: airport.Type,
data: airport,
} }
return a return a
@ -49,9 +46,9 @@ func UniqAirports(r []*Airport) []*Airport {
func SortAirports(r []*Airport) { func SortAirports(r []*Airport) {
sort.Slice(r, func(i, j int) bool { sort.Slice(r, func(i, j int) bool {
if r[i].data.Type == r[j].data.Type { if r[i].Type == r[j].Type {
return r[i].Distance < r[j].Distance return r[i].Distance < r[j].Distance
} }
return r[i].data.Type < r[j].data.Type return r[i].Type < r[j].Type
}) })
} }