]> Cypherpunks repositories - gostls13.git/commit
os: add File.ReadDir method and DirEntry type
authorRuss Cox <rsc@golang.org>
Fri, 9 Oct 2020 15:49:59 +0000 (11:49 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 20 Oct 2020 00:59:20 +0000 (00:59 +0000)
commita4ede9f9a6254360d39d0f45aec133c355ac6b2a
treeb7e25cc247303143957f1937a9cfdd3e79fd8004
parent8fe372c7b36b4d078c871a26e10b427c41275ecd
os: add File.ReadDir method and DirEntry type

ReadDir provides a portable, efficient way to read a directory
and discover the type of directory entries.
This enables a more efficient file system walk, yet to be added.

See #41467 for the proposal review for the API.

Fixes #41467.

Change-Id: I461a526793ae46df48821aa448b04f1705546739
Reviewed-on: https://go-review.googlesource.com/c/go/+/261540
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
20 files changed:
src/os/dir.go
src/os/dir_darwin.go
src/os/dir_plan9.go
src/os/dir_unix.go
src/os/dir_windows.go
src/os/dirent_aix.go [new file with mode: 0644]
src/os/dirent_dragonfly.go [new file with mode: 0644]
src/os/dirent_freebsd.go [new file with mode: 0644]
src/os/dirent_js.go [new file with mode: 0644]
src/os/dirent_linux.go [new file with mode: 0644]
src/os/dirent_netbsd.go [new file with mode: 0644]
src/os/dirent_openbsd.go [new file with mode: 0644]
src/os/dirent_solaris.go [new file with mode: 0644]
src/os/endian_big.go [new file with mode: 0644]
src/os/endian_little.go [new file with mode: 0644]
src/os/export_test.go
src/os/file_unix.go
src/os/os_test.go
src/os/stat_plan9.go
src/os/types.go