Pull request: all: rm var shadowing vol. 3

Updates #2803.

Squashed commit of the following:

commit ce711ae2e08c3714a4e0c6d177c02f7801c05fce
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Mar 11 20:58:40 2021 +0300

    all: imp code, docs

commit e91094e461893c27eda879b33b5ed2c7085510df
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Mar 11 20:42:14 2021 +0300

    all: rm var shadowing vol. 3
This commit is contained in:
Ainar Garipov
2021-03-11 21:30:52 +03:00
parent 4cf44dd1d4
commit 968831c5b9
13 changed files with 47 additions and 39 deletions

View File

@@ -328,18 +328,17 @@ func ValidateUpstreams(upstreams []string) error {
var defaultUpstreamFound bool
for _, u := range upstreams {
d, err := validateUpstream(u)
var ok bool
ok, err = validateUpstream(u)
if err != nil {
return err
}
// Check this flag until default upstream will not be found
if !defaultUpstreamFound {
defaultUpstreamFound = d
defaultUpstreamFound = ok
}
}
// Return error if there are no default upstreams
if !defaultUpstreamFound {
return fmt.Errorf("no default upstreams specified")
}
@@ -477,7 +476,7 @@ func checkDNS(input string, bootstrap []string) error {
return nil
}
if _, err := validateUpstream(input); err != nil {
if _, err = validateUpstream(input); err != nil {
return fmt.Errorf("wrong upstream format: %w", err)
}