types: don't use a private field
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
15bc706d7a
commit
c56a9b206c
@ -12,8 +12,6 @@ type Airport struct {
|
||||
Code string
|
||||
Distance float64
|
||||
Type string
|
||||
|
||||
data *alphafoxtrot.Airport
|
||||
}
|
||||
|
||||
func NewAirport(airport *alphafoxtrot.Airport) *Airport {
|
||||
@ -23,7 +21,6 @@ func NewAirport(airport *alphafoxtrot.Airport) *Airport {
|
||||
Name: airport.Name,
|
||||
Code: code,
|
||||
Type: airport.Type,
|
||||
data: airport,
|
||||
}
|
||||
|
||||
return a
|
||||
@ -49,9 +46,9 @@ func UniqAirports(r []*Airport) []*Airport {
|
||||
|
||||
func SortAirports(r []*Airport) {
|
||||
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].data.Type < r[j].data.Type
|
||||
return r[i].Type < r[j].Type
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user