Skip to content
This repository has been archived by the owner on May 18, 2022. It is now read-only.

Commit

Permalink
Reduced nesting.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdwhatcott committed Aug 14, 2017
1 parent 799cbc9 commit c2a2799
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions smartyping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit c2a2799

Please sign in to comment.