all: Fix nested if with else if (#8467)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
@@ -142,11 +142,9 @@ func TestGlobalOverHTTPS(t *testing.T) {
|
||||
url = "https://" + list.Addr().String() + "?insecure"
|
||||
if addresses, err := testLookup(url); err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
} else {
|
||||
if len(addresses) != 1 || addresses[0] != "tcp://192.0.2.42::22000" {
|
||||
} else if len(addresses) != 1 || addresses[0] != "tcp://192.0.2.42::22000" {
|
||||
t.Errorf("incorrect addresses list: %+v", addresses)
|
||||
}
|
||||
}
|
||||
|
||||
// With "id" set to something incorrect, the checks should fail again.
|
||||
|
||||
@@ -162,12 +160,10 @@ func TestGlobalOverHTTPS(t *testing.T) {
|
||||
url = "https://" + list.Addr().String() + "?id=" + id.String()
|
||||
if addresses, err := testLookup(url); err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
} else {
|
||||
if len(addresses) != 1 || addresses[0] != "tcp://192.0.2.42::22000" {
|
||||
} else if len(addresses) != 1 || addresses[0] != "tcp://192.0.2.42::22000" {
|
||||
t.Errorf("incorrect addresses list: %+v", addresses)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGlobalAnnounce(t *testing.T) {
|
||||
// Generate a server certificate.
|
||||
|
||||
@@ -289,12 +289,10 @@ func (m *Matcher) Match(file string) (result Result) {
|
||||
if pattern.match.Match(lowercaseFile) {
|
||||
return pattern.result
|
||||
}
|
||||
} else {
|
||||
if pattern.match.Match(file) {
|
||||
} else if pattern.match.Match(file) {
|
||||
return pattern.result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Default to not matching.
|
||||
return resultNotMatched
|
||||
|
||||
Reference in New Issue
Block a user