Hello,
I am working on a program that could potentially make a lot of network calls out which I think may really slow it down or potentially do worse things. The code that makes me the most worried is the snippet below:
for hostbuff.Scan() { //Buffer From File With Hostnames
assetips, err := net.LookupIP(hostbuff.Text()) //Lookup IP And Put in Array
// go assetips, err := net.LookupIP(hostbuff.Text()) //Would this work?
if err != nil {
fmt.Println("We had IP lookup error")
}
for _, ip := range assetips {
//do stuff
With net.LookupIP I am resolving a lot of hostnames to get IP addresses to put them in an array. With those IP addresses I am performing different types of work. I am most concerned with the net.LookupIP function. Is there a recommended way or ideas to make this concurrent such as using Goroutines or other methods. The first thing that comes up in my mind is to just go assetips, err := net.LookupIP(hostbuff.Text()) but I am worried that could cause problems.
Thanks in advance,
Joe