Refactoring of parseColumnsFilter function.
ELSE block is unnecessary as IF blocks end with a return statement.
@@ -1385,6 +1385,7 @@ func stringInSlice(s string, list []string) bool {
}
func parseColumnsFilter(columns string) (bigtable.Filter, error) {
+
splitColumns := strings.FieldsFunc(columns, func(c rune) bool { return c == ',' })
if len(splitColumns) == 1 {
filter, err := columnFilter(splitColumns[0])
@@ -1392,7 +1393,8 @@ func parseColumnsFilter(columns string) (bigtable.Filter, error) {
return nil, err
}
return filter, nil
- } else {
+ }
+
var columnFilters []bigtable.Filter
for _, column := range splitColumns {
filter, err := columnFilter(column)
@@ -1403,7 +1405,6 @@ func parseColumnsFilter(columns string) (bigtable.Filter, error) {
}
return bigtable.InterleaveFilters(columnFilters...), nil
}
-}
func columnFilter(column string) (bigtable.Filter, error) {
splitColumn := strings.Split(column, ":")
