I'm running a piece of golang code to resolve a url.
This url should returns one ip on 50% of the requests and another ip on the others 50%.
This is working when I perform the host
command but not when I resolve the DNS using Go. On my research, every answer I saw they said Golang doesn't cache DNS but the behavior seems to be different.
Can anyone clarify that?
Here is my code and I'm using a for loop to run it 100 times:
for value in {1..100};do go run main.go;done
"fmt"
"net"
)
func main() {
iprecords, _ := net.LookupIP("google.com")
for _, ip := range iprecords {
fmt.Println(ip)
}
}
CGO
enabled (go build default) or disabled?host
and your code actually query the same resolver.