Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net: tests fail if /etc/hosts lists localhost 127.0.0.1 twice #6363
I just downloaded the source code release branch from code.google.com per the instructions, then ran all.bash: hg clone ... hg update release cd go/src ./all.bash ... --- FAIL: TestLookupHost (0.00 seconds) hosts_test.go:65: LookupHost("localhost") = [127.0.0.1 127.0.0.1], has duplicate addresses FAIL FAIL net 2.379s ... My /etc/hosts is managed by a config management tool and just happens to have put two localhost entries in there (I didn't know this until now ;-) cat /etc/hosts ... 127.0.0.1 gunstar localhost ... 127.0.0.1 localhost The test seems a bit fragile because it relies on config outside the control of the Go source code.
Everything about the net tests is a little fragile. Even so, they serve a useful purpose. What this test is referring to is that getaddrinfo will return 127.0.0.1 once for SOCK_STREAM and once for SOCK_DGRAM, even when it appears just once in the hosts file. In this case it has returned it four times, and the Go code has (correctly I think) cut it down to two. I'm inclined to leave this as is unless more people run into it. Is it possible for you to get your /etc/hosts fixed?
Labels changed: added priority-later, removed priority-triage.
Status changed to Thinking.