From c2a27992b6f1959a516530789575afeb970f02e0 Mon Sep 17 00:00:00 2001 From: Michael Whatcott Date: Mon, 14 Aug 2017 15:05:54 -0600 Subject: [PATCH] Reduced nesting. --- smartyping_test.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/smartyping_test.go b/smartyping_test.go index cf70394..663e4e2 100644 --- a/smartyping_test.go +++ b/smartyping_test.go @@ -26,22 +26,24 @@ func Test(t *testing.T) { ips, err := net.LookupIP(domain) if err != nil { t.Errorf("Could not resolve IP addresses for %s: %s", domain, err) - } else { - for _, ip := range ips { - t.Run(ip.String(), func(t *testing.T) { - t.Parallel() - - if response, err := ping(ip.String(), domain); err != nil { - t.Error(err) - } else { - cleanup(response) - } - }) - } + return + } + + for _, ip := range ips { + t.Run(ip.String(), func(t *testing.T) { + t.Parallel() + + if response, err := ping(ip.String(), domain); err != nil { + t.Error(err) + } else { + cleanup(response) + } + }) } }) } } + func ping(ip string, domain string) (*http.Response, error) { return buildClient(ip, domain).Get("https://" + domain) }