Skip to content

Commit 7853ec8

Browse files
committed
[skip-changelog] Removed useless file-readable check while enumerating source code files (#2418)
* Removed useless file filter * Removed unused variable
1 parent 1c80c05 commit 7853ec8

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

arduino/builder/internal/utils/utils.go

-15
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"strings"
2121
"unicode"
2222

23-
"github.com/arduino/arduino-cli/i18n"
2423
f "github.com/arduino/arduino-cli/internal/algorithms"
2524
"github.com/arduino/go-paths-helper"
2625
"github.com/pkg/errors"
@@ -30,8 +29,6 @@ import (
3029
"golang.org/x/text/unicode/norm"
3130
)
3231

33-
var tr = i18n.Tr
34-
3532
// ObjFileIsUpToDate fixdoc
3633
func ObjFileIsUpToDate(sourceFile, objectFile, dependencyFile *paths.Path) (bool, error) {
3734
logrus.Debugf("Checking previous results for %v (result = %v, dep = %v)", sourceFile, objectFile, dependencyFile)
@@ -160,17 +157,6 @@ func filterOutSCCS(file *paths.Path) bool {
160157
return !sourceControlFolders[file.Base()]
161158
}
162159

163-
// filterReadableFiles is a ReadDirFilter that accepts only readable files
164-
func filterReadableFiles(file *paths.Path) bool {
165-
// See if the file is readable by opening it
166-
f, err := file.Open()
167-
if err != nil {
168-
return false
169-
}
170-
f.Close()
171-
return true
172-
}
173-
174160
// filterOutHiddenFiles is a ReadDirFilter that exclude files with a "." prefix in their name
175161
var filterOutHiddenFiles = paths.FilterOutPrefixes(".")
176162

@@ -180,7 +166,6 @@ func FindFilesInFolder(dir *paths.Path, recurse bool, extensions ...string) (pat
180166
filterOutHiddenFiles,
181167
filterOutSCCS,
182168
paths.FilterOutDirectories(),
183-
filterReadableFiles,
184169
)
185170
if len(extensions) > 0 {
186171
fileFilter = paths.AndFilter(

0 commit comments

Comments
 (0)