这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions cli/internal/fs/copy_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ func Walk(rootPath string, callback func(name string, isDir bool) error) error {
// WalkMode is like Walk but the callback receives an additional type specifying the file mode type.
// N.B. This only includes the bits of the mode that determine the mode type, not the permissions.
func WalkMode(rootPath string, callback func(name string, isDir bool, mode os.FileMode) error) error {
// Compatibility with filepath.Walk which allows passing a file as the root argument.
if info, err := os.Lstat(rootPath); err != nil {
return err
} else if !info.IsDir() {
return callback(rootPath, false, info.Mode())
}
return godirwalk.Walk(rootPath, &godirwalk.Options{
Callback: func(name string, info *godirwalk.Dirent) error {
return callback(name, info.IsDir(), info.ModeType())
if isDirLike, err := info.IsDirOrSymlinkToDir(); err == nil {
return callback(name, isDirLike, info.ModeType())
} else {
return err
}
},
Unsorted: true,
Unsorted: true,
AllowNonDirectory: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This setting just does what the deleted compat code does already

FollowSymbolicLinks: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defaults to false anyway, but setting it explicitly, because some functionality depends on not following symlinks. For example, following symlinks in node_modules a yarn workspace will send you right back to the source code.

})
}

Expand Down