{"action":"opened","issue":{"url":"https://api.github.com/repos/golang/go/issues/12421","labels_url":"https://api.github.com/repos/golang/go/issues/12421/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/12421/comments","events_url":"https://api.github.com/repos/golang/go/issues/12421/events","html_url":"https://github.com/golang/go/issues/12421","id":104151668,"number":12421,"title":"net: go/cgo resolvers report malformed domains differently","user":{"login":"pmarks-net","id":4578188,"avatar_url":"https://avatars.githubusercontent.com/u/4578188?v=3","gravatar_id":"","url":"https://api.github.com/users/pmarks-net","html_url":"https://github.com/pmarks-net","followers_url":"https://api.github.com/users/pmarks-net/followers","following_url":"https://api.github.com/users/pmarks-net/following{/other_user}","gists_url":"https://api.github.com/users/pmarks-net/gists{/gist_id}","starred_url":"https://api.github.com/users/pmarks-net/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmarks-net/subscriptions","organizations_url":"https://api.github.com/users/pmarks-net/orgs","repos_url":"https://api.github.com/users/pmarks-net/repos","events_url":"https://api.github.com/users/pmarks-net/events{/privacy}","received_events_url":"https://api.github.com/users/pmarks-net/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-31T23:12:18Z","updated_at":"2015-08-31T23:12:18Z","closed_at":null,"body":"Given the following program:\r\n\r\n    package main\r\n    \r\n    import (\r\n            \"net\"\r\n            \"fmt\"\r\n    )\r\n    \r\n    func main() {\r\n            ips, err := net.LookupIP(\"!!!.local\")\r\n            fmt.Printf(\"%v %v\\n\", ips, err)\r\n    }\r\n\r\nA different error message is produced, depending on whether the go or cgo resolver is used:\r\n    \r\n    ~/src/go/src$ GODEBUG=netdns=go ../bin/go run ~/test/lookup.go\r\n    [] lookup !!!.local: invalid domain name\r\n    ~/src/go/src$ GODEBUG=netdns=cgo ../bin/go run ~/test/lookup.go\r\n    [] lookup !!!.local: no such host\r\n\r\nThis discrepancy exists because `src/net/dnsclient.go` uses `isDomainName` as a filter before starting the lookup, while `getaddrinfo` has no such filter, and returns the same error for malformed and nonexistent (NXDOMAIN) names.\r\n\r\nI think it's debatable whether this qualifies as a bug, but in theory it could be fixed by having the cgo implementation check `isDomainName`."}}