master
 1package main
 2
 3type WebsiteChecker func(string) bool
 4type result struct {
 5	string
 6	bool
 7}
 8
 9func CheckWebsites(wc WebsiteChecker, urls []string) map[string]bool {
10	results := make(map[string]bool)
11	resultChannel := make(chan result)
12
13	for _, url := range urls {
14		go func(u string) {
15			resultChannel <- result{u, wc(u)}
16		}(url)
17	}
18
19	for i := 0; i < len(urls); i++ {
20		result := <-resultChannel
21		results[result.string] = result.bool
22	}
23
24	return results
25}