diff --git a/internal/util/util.go b/internal/util/util.go index 71c257c06..9167836fd 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -431,7 +431,10 @@ func ParseBigtableGroup(s string) []string { if err == io.EOF { break } - tables = append(tables, strings.TrimSpace(string(line))) + t := strings.TrimSpace(string(line)) + if t != "" { + tables = append(tables, t) + } } return tables } diff --git a/internal/util/util_test.go b/internal/util/util_test.go index 4b4e89c4d..383ec6cd6 100644 --- a/internal/util/util_test.go +++ b/internal/util/util_test.go @@ -212,3 +212,18 @@ func TestKeysToSlice(t *testing.T) { t.Errorf("places.keysToSlice(%v) = %v; expected %v", m, result, expected) } } + +func TestParseBigtableGroup(t *testing.T) { + for _, c := range []struct { + input string + want []string + }{ + {"table1\ntable2\n\n", []string{"table1", "table2"}}, + {"table1 \n table2\n", []string{"table1", "table2"}}, + } { + got := ParseBigtableGroup(c.input) + if diff := cmp.Diff(got, c.want); diff != "" { + t.Errorf("ParseBigtableGroup got diff %+v", diff) + } + } +}