Skip to content

Commit

Permalink
ignore irregular files
Browse files Browse the repository at this point in the history
Load should skip symlinks and other irregular files.

closes cue-lang#1672
  • Loading branch information
kcburge committed Apr 27, 2022
1 parent 00c5ddf commit 0c8aef0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cue/load/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,15 @@ func (l *loader) importPkg(pos token.Pos, p *build.Instance) []*build.Instance {
return retErr(errors.Wrapf(err, pos, "import failed reading dir %v", dirs[0][1]))
}
for _, f := range files {
if f.IsDir() {
switch mode := f.Mode(); mode & os.ModeType {
case 0:
case os.ModeDir:
continue
default:
p.UnknownFiles = append(p.UnknownFiles, &build.File{
Filename: f.Name(),
ExcludeReason: errors.Newf(token.NoPos, "unknown file %d", mode),
})
continue
}
if f.Name() == "-" {
Expand Down

0 comments on commit 0c8aef0

Please sign in to comment.