Skip to content

Commit a045e59

Browse files
committed
Factoring regexps creation
1 parent 64ed47e commit a045e59

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

utils/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ func GetCompatibleWith(name string) map[string][]firmware {
5555
exePath, _ := os.Executable()
5656
root := filepath.Dir(exePath)
5757
root = filepath.Join(root, "firmwares")
58+
loader := regexp.MustCompile(knownBoards[name].loader)
59+
fw := regexp.MustCompile(knownBoards[name].match)
5860

5961
err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
6062
unixPath := filepath.ToSlash(path)
6163
parts := strings.Split(unixPath, "/")
6264
fancyName := parts[len(parts)-3] + " " + parts[len(parts)-2]
63-
loader := regexp.MustCompile(knownBoards[name].loader)
64-
fw := regexp.MustCompile(knownBoards[name].match)
6565
f := firmware{
6666
Path: path,
6767
Name: fancyName,

0 commit comments

Comments
 (0)