With wg.Done() at the bottom of doWork function and loop returning on error the program would freeze if there was an error. So I've added defer to wg.Done() and moved it to the top. I also think it would be better to continue in the loop instead of return on error, this way program will keep checking other IPs from the list.
With wg.Done() at the bottom of doWork function and loop returning on error the program would freeze if there was an error. So I've added defer to wg.Done() and moved it to the top. I also think it would be better to continue in the loop instead of return on error, this way program will keep checking other IPs from the list.