add gocritic/ruleguard checks back again, cleanup code. (#13665)

- remove some duplicated code
- reported a bug, separately fixed in #13664
- using strings.ReplaceAll() when needed
- using filepath.ToSlash() use when needed
- remove all non-Go style comments from the codebase

Co-authored-by: Aditya Manthramurthy <donatello@users.noreply.github.com>
This commit is contained in:
Harshavardhana
2021-11-16 09:28:29 -08:00
committed by GitHub
parent 07c5e72cdb
commit 661b263e77
111 changed files with 409 additions and 450 deletions
+4 -8
View File
@@ -341,21 +341,17 @@ func sameLocalAddrs(addr1, addr2 string) (bool, error) {
if host1 == "" {
// If empty host means it is localhost
addr1Local = true
} else {
} else if addr1Local, err = isLocalHost(host1, port1, port1); err != nil {
// Host not empty, check if it is local
if addr1Local, err = isLocalHost(host1, port1, port1); err != nil {
return false, err
}
return false, err
}
if host2 == "" {
// If empty host means it is localhost
addr2Local = true
} else {
} else if addr2Local, err = isLocalHost(host2, port2, port2); err != nil {
// Host not empty, check if it is local
if addr2Local, err = isLocalHost(host2, port2, port2); err != nil {
return false, err
}
return false, err
}
// If both of addresses point to the same machine, check if