Yes, Go does make writing stuff like that nice, but I think the actual code given is pretty heavyweight. This does the same thing: package main import ( "fmt" "net" "io/ioutil" "strings" ) func main() { file_in, _ := ioutil.ReadFile("domains.txt") domain_list := string(file_in) done := make(chan bool) count := 0 for _, domain := range strings.Split(strings.TrimSpace(domain_list), "\n") { go func(d string) { ipAddress…
I know it's about Go, but bash is awesome for stuff like this: while read line; do host $line | head -n1 | awk '{print $1 " -> " $4}' & done
If you gnu parallel (xargs++) installed - turn that second line into a script (and replace $line with $1).
cat domains.txt | parallel -n 1 -P 50 script.sh