]> Cypherpunks repositories - gostls13.git/commit
os: return nil slice when ReadDir is used with a file on file_windows
authorqmuntal <quimmuntal@gmail.com>
Wed, 27 Aug 2025 07:12:29 +0000 (09:12 +0200)
committerQuim Muntal <quimmuntal@gmail.com>
Thu, 28 Aug 2025 04:44:39 +0000 (21:44 -0700)
commite47d88beae126387647348810b728ed12c8a0d61
treee73aa79ab421289c8f64a9af9838a1fd3cda4112
parent6b837a64dbe6264035037d61c56ab94b55b2844d
os: return nil slice when ReadDir is used with a file on file_windows

ReadDir should return (nil, ENOTDIR) when the path points to a file
instead of a directory. That's the behavior on Unix systems, and it also
used to be the behavior on Windows. However, Windows currently returns
([]DirEntry{}, ENOTDIR).

We should change the implementation to match the expected behavior.

Fixed #75157

Change-Id: I3a3ddb71b5cd6e51dbca435a1585f01116844d4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/699375
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Steven Hartland <stevenmhartland@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/internal/syscall/windows/at_windows.go
src/os/file_windows.go
src/os/read_test.go
src/syscall/syscall_windows.go
src/syscall/types_windows.go