I am using this but it doesn't feel right:
if err, ok := err.(net.Error); ok {
var message string
if err.Timeout() {
message = "Timeout"
} else if strings.HasSuffix(err.Error(), "no such host") {
message = "No such host"
}
}
Is there a more idiomatic way?