Skip to content

Commit 33977d0

Browse files
committed
go.work and *.sql files can be also solution files
1 parent c79b73e commit 33977d0

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

trainings/files/read.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package files
22

33
import (
44
"os"
5+
"path"
56
"path/filepath"
67

78
"github.com/pkg/errors"
@@ -25,7 +26,7 @@ func (f Files) ReadSolutionFiles(trainingRootFs afero.Fs, dir string) ([]*genpro
2526
if info.IsDir() {
2627
return nil
2728
}
28-
if filepath.Ext(info.Name()) != ".go" && info.Name() != "go.mod" {
29+
if !isSolutionFile(info) {
2930
return nil
3031
}
3132

@@ -60,3 +61,20 @@ func (f Files) ReadSolutionFiles(trainingRootFs afero.Fs, dir string) ([]*genpro
6061

6162
return files, nil
6263
}
64+
65+
func isSolutionFile(info os.FileInfo) bool {
66+
if filepath.Ext(info.Name()) == ".go" {
67+
return true
68+
}
69+
if info.Name() == "go.mod" {
70+
return true
71+
}
72+
if info.Name() == "go.work" {
73+
return true
74+
}
75+
if path.Ext(info.Name()) != ".sql" {
76+
return true
77+
}
78+
79+
return false
80+
}

0 commit comments

Comments
 (0)