golang/go
View on GitHubnet: LookupHost shows different results between GODEBUG=netdns=cgo and go
Open
#22,902 opened on Nov 28, 2017
NeedsFixhelp wanted
Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
What version of Go are you using (go version)?
go version go1.9.2 darwin/amd64
What did you do?
package main
import (
"net"
"fmt"
)
func main() {
fmt.Println(net.LookupHost("10.256"))
fmt.Println(net.LookupHost("10.256.1"))
fmt.Println(net.LookupHost("10.10.256"))
fmt.Println(net.LookupHost("10.10.256.1"))
fmt.Println(net.LookupHost("10.10.10.256"))
}
What did you expect to see?
This program works fine on both Linux & Windows and does show below output, but not on Mac
[] lookup 10.256: no such host
[] lookup 10.256.1: no such host
[] lookup 10.10.256: no such host
[] lookup 10.10.256.1: no such host
[] lookup 10.10.10.256: no such host
What did you see instead?
[10.0.1.0] <nil>
[] lookup 10.256.1: no such host
[10.10.1.0] <nil>
[] lookup 10.10.256.1: no such host
[] lookup 10.10.10.256: no such host