diff options
author | Kevin Wallace <doof@doof.net> | 2019-02-22 00:30:03 -0800 |
---|---|---|
committer | Kevin Wallace <doof@doof.net> | 2019-02-22 00:30:03 -0800 |
commit | 191d8306062692a204603eda2ea307ed8c726598 (patch) | |
tree | fcb17f28c5dc0cb70dbff5f18e3b7e128fa620c1 | |
parent | silence "no such host" errors (diff) |
catch NXDOMAIN-related errors on OSX, too
Maybe time to move off of the stdlib dns library. This error handling sucks.
-rw-r--r-- | main.go | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -45,7 +45,10 @@ func main() { } func printErr(ip net.IP, rrtype string, err error) { - if !strings.Contains(err.Error(), "no such host") { + // the error types here are awful and this feels like it might + // accidentally catch some non-NXDOMAIN errors + if !strings.HasSuffix(err.Error(), "no such host") && + !strings.HasSuffix(err.Error(), "nodename nor servname provided, or not known") { fmt.Fprintf(os.Stderr, "%s\t# %s error: %s\n", ip, rrtype, err) } } |