parse.HostPortorFile: return error when 0 found (#3742)

* parse.HostPortorFile: return error when 0 found

Return an error when we haven't found any nameservers. This is the
alternative considered in #3735. It's also slighly less code to be
changing.

Replaces: #3741
Closes: #3741 #3735

Signed-off-by: Miek Gieben <miek@miek.nl>

* Add extra test case here as well

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben
2020-03-13 14:23:10 +01:00
committed by GitHub
parent 68ddba05da
commit c52a51fac8
3 changed files with 13 additions and 0 deletions

View File

@@ -54,6 +54,11 @@ func TestHostPortOrFile(t *testing.T) {
"[fd01::1%ens3]:153",
false,
},
{
"8.9.1043",
"",
true,
},
}
err := ioutil.WriteFile("resolv.conf", []byte("nameserver 127.0.0.1\n"), 0600)