Hello Gophers,
I'm running unit test in my local windows machine (Windows 11 Pro) and I get a test failure for TestLookupLocalPtr using my locally compiled Go 1.25
here is the test command that I run
PS C:\Users\grand\projects\go\src\net> ../../bin/go test -v ./...
=== RUN TestLookupLocalPTR
lookup_windows_test.go:174: different results
192.168.1.56:
exp:["host.docker.internal."]
got:["gateway.docker.internal.","host.docker.internal."]
Upon checking the unit test, it looks like it's testing whether
LookupAddr and
lookupPTR retuns the same result
I believe
LookupAddr is getting the DNSs by calling Windows API and looking at the
C:\Windows\System32\drivers\etc\hosts
my hosts file indeed has 2 entries for the IP:
# Added by Docker Desktop
192.168.1.56 host.docker.internal
192.168.1.56 gateway.docker.internal
while
lookupPTR implementation seems to rely on the output from ping
essentially it's this ping command
ping -n -1 -a <addr> and doing a regex matching
`(?m)^Pinging\s+([a-zA-Z0-9.\-]+)\s+\[.*$`
I tested the ping command in my windows
(base) C:\Users\grand>ping -n 1 -a 192.168.1.56
Pinging host.docker.internal [192.168.1.56] with 32 bytes of data:
Reply from
192.168.1.56: bytes=32 time<1ms TTL=128
Ping statistics for
192.168.1.56:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
And it only produces 1 result
I was about to open an issue in Github, however, I have limited background knowledge for this and I would like some inputs whether this is an issue in the unit test or is an issue in the implementation of some of the functions
Let me know should you require more info
Thank you for your inputs!