Skip to content

Commit f7ad23c

Browse files
authored
dinosql: Inline addFile (#446)
1 parent 4ac3d6b commit f7ad23c

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

internal/dinosql/parser.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,6 @@ func (e *ParserErr) Error() string {
6060
return fmt.Sprintf("multiple errors: %d errors", len(e.Errs))
6161
}
6262

63-
func addFile(files []string, newFile string) []string {
64-
if migrations.IsDown(newFile) {
65-
return files
66-
}
67-
return append(files, newFile)
68-
}
69-
7063
func ReadSQLFiles(paths []string) ([]string, error) {
7164
var files []string
7265
for _, path := range paths {
@@ -81,10 +74,15 @@ func ReadSQLFiles(paths []string) ([]string, error) {
8174
return nil, err
8275
}
8376
for _, f := range listing {
84-
files = addFile(files, filepath.Join(path, f.Name()))
77+
if migrations.IsDown(f.Name()) {
78+
continue
79+
}
80+
files = append(files, filepath.Join(path, f.Name()))
8581
}
8682
} else {
87-
files = addFile(files, path)
83+
if !migrations.IsDown(path) {
84+
files = append(files, path)
85+
}
8886
}
8987
}
9088
return files, nil

0 commit comments

Comments
 (0)