Simplify if statement for single bool judgment GO-R1004
Anti-pattern
Minor
6 months agoa year old
IfStmt with single bool judgement could be simplified
219							ffi.Name = fmt.Sprintf("%s%d", mi.Name, cnt)
220							ffi.Column = ffi.Name
221							ffi.FullName = rmi.FullName + "." + ffi.Name
222							if added = rmi.Fields.Add(ffi); added {223								break
224							}
225						}
IfStmt with single bool judgement could be simplified
376			wildcardValues = append(wildcardValues, pattern[start:i])
377		}
378		for _, l := range t.leaves {
379			if ok := l.match(treePattern, wildcardValues, ctx); ok {380				return l.runObject
381			}
382		}
IfStmt with single bool judgement could be simplified
308		}
309		if t.wildcard != nil {
310			for _, l := range t.wildcard.leaves {
311				if ok := l.match(treePattern, wildcardValues, ctx); ok {312					return l.runObject
313				}
314			}
IfStmt with single bool judgement could be simplified
302	// Handle leaf nodes:
303	if pattern == "" {
304		for _, l := range t.leaves {
305			if ok := l.match(treePattern, wildcardValues, ctx); ok {306				return l.runObject
307			}
308		}
IfStmt with single bool judgement could be simplified
62
63func TestDelete(t *testing.T) {
64	safeMap.Delete("astaxie")
65	if exists := safeMap.Check("astaxie"); exists {66		t.Error("expected element to be deleted")
67	}
68}