When trying to obtain a SRV record from a registry using bad DNS address, method LoadBalancer.Next() fails to report the actual error. It simply states that Couldn't resolve name 'my-service.service.consul.'.
This obscures the reason for the error and makes it look like the issue is caused by a missing SRV record, while the actual reason is inability to connect to the registry.
A more informative and go-idiomatic error message would concatenate the inner error.
Here are examples of what this might look like in a real world scenario:
Couldn't resolve name 'my-service.service.consul.': dial tcp 10.140.21.242:8600: i/o timeout;
Couldn't resolve name 'my-service.service.consul.': dial tcp: lookup my-bad-dns-name on 10.0.22.33:53: no such host;
Couldn't resolve name 'my-service.service.consul.': dial tcp 127.0.0.1:8601: connectex: No connection could be made because the target machine actively refused it.;
When trying to obtain a SRV record from a registry using bad DNS address, method
LoadBalancer.Next()
fails to report the actual error. It simply states thatCouldn't resolve name 'my-service.service.consul.'
.This obscures the reason for the error and makes it look like the issue is caused by a missing SRV record, while the actual reason is inability to connect to the registry.
A more informative and go-idiomatic error message would concatenate the inner error.
Here are examples of what this might look like in a real world scenario:
Couldn't resolve name 'my-service.service.consul.': dial tcp 10.140.21.242:8600: i/o timeout;
Couldn't resolve name 'my-service.service.consul.': dial tcp: lookup my-bad-dns-name on 10.0.22.33:53: no such host;
Couldn't resolve name 'my-service.service.consul.': dial tcp 127.0.0.1:8601: connectex: No connection could be made because the target machine actively refused it.;