We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f0728c4 commit c8c4a4eCopy full SHA for c8c4a4e
_demo/readdir/main.go
@@ -0,0 +1,19 @@
1
+package main
2
+
3
+import (
4
+ "fmt"
5
+ "os"
6
+)
7
8
+func main() {
9
+ entries, err := os.ReadDir("../")
10
+ if err != nil {
11
+ panic(err)
12
+ }
13
+ if len(entries) == 0 {
14
+ panic("No files found")
15
16
+ for _, e := range entries {
17
+ fmt.Printf("%s isDir[%t]\n", e.Name(), e.IsDir())
18
19
+}
runtime/internal/lib/os/dir.go
@@ -120,6 +120,8 @@ func direntNamePtr(name any) *byte {
120
return name
121
case []byte:
122
return &name[0]
123
+ case [1024]int8:
124
+ return (*byte)(unsafe.Pointer(&name[0]))
125
default:
126
panic("invalid type")
127
}
0 commit comments