Browse Source

filtering code cleanup

boyska 5 years ago
parent
commit
5db7e2f01b
1 changed files with 4 additions and 7 deletions
  1. 4 7
      filtering/filter.go

+ 4 - 7
filtering/filter.go

@@ -48,12 +48,9 @@ func (e *ExprValue) Validate(line map[string]interface{}) bool {
 	if !ok || val == nil { // errors when evaluating
 		return false
 	}
-	if val.Type() != value.BoolType {
-		fmt.Fprintln(os.Stderr, "WARNING: The 'where' expression doesn't return a boolean")
-		return false
-	}
-	if val.Value().(bool) != true {
-		return false
+	if bv, isBool := val.(value.BoolValue); isBool {
+		return bv.Val()
 	}
-	return true
+	fmt.Fprintln(os.Stderr, "WARNING: The 'where' expression doesn't return a boolean")
+	return false
 }