This is a question about the net/http API, Googling was not very helpful.

    _, err := http.Get("https://random_non_existing_domain.com";)


Following code will obviously fail, but how can I check if it failed 
because of DNS error not because a billion other things that might have 
gone wrong?

I tried this, (mostly as a shot in the dark)

        if e, ok := err.(net.Error); ok {
            fmt.Println("dial error", e.Temporary())
        }
        if e, ok := err.(*net.AddrError); ok {
            fmt.Println("addr rror", e.Temporary())
        }
        if e, ok := err.(*net.DNSError); ok {
            fmt.Println(e)

and it seems to print 

       dial error false

Is there any easy way to do what I'm trying to achieve?

-
dbalan
@notmycommit


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to