1
0
mirror of https://github.com/golang/go synced 2024-11-17 12:14:47 -07:00

fix logic

This commit is contained in:
Mateusz Poliwczak 2022-11-03 15:01:34 +01:00
parent a8874674ae
commit fbbd8e10de

View File

@ -274,11 +274,13 @@ func TestDNSNameLength(t *testing.T) {
t.Fatal(conf.err)
}
var shortestSuffix int
if len(tt.want.search) == 0 {
shortestSuffix = len(dnsDefaultSearch())
suffixList := tt.want.search
if len(suffixList) == 0 {
suffixList = dnsDefaultSearch()
}
for _, suffix := range tt.want.search {
var shortestSuffix int
for _, suffix := range suffixList {
if shortestSuffix == 0 || len(suffix) < shortestSuffix {
shortestSuffix = len(suffix)
}