Remove dead code
This commit is contained in:
parent
ce53ef58da
commit
cd30fe9634
27
swapi.go
27
swapi.go
|
@ -158,30 +158,3 @@ func GetStarshipsPilots(starships []*Starship) map[*Starship][]*Person {
|
|||
|
||||
return result
|
||||
}
|
||||
|
||||
// Retrieves all the pilots for a given [Starship] simultaneously
|
||||
func GetPilots(starship *Starship) []*Person {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
c := make(chan *Person)
|
||||
for i := range starship.Pilots {
|
||||
wg.Add(1)
|
||||
go func(url string) {
|
||||
person, _ := GetPerson(url)
|
||||
if person != nil {
|
||||
c <- person
|
||||
}
|
||||
}(starship.Pilots[i])
|
||||
}
|
||||
|
||||
go func() {
|
||||
wg.Wait()
|
||||
close(c)
|
||||
}()
|
||||
|
||||
var result []*Person
|
||||
for r := range c {
|
||||
result = append(result, r)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue