hello everyone noob here π
i'm following this book with an example on how to list the files in a directory and determine if the it is a directory or not.
func main() {
files, err := ioutil.ReadDir("my_directory")
if err != nil {
log.Fatal(err)
}
for _, file := range files {
if !file.IsDir() {
fmt.Println("file:", file.Name())
continue
}
fmt.Println("directory:", file.Name())
}
}
but my ide is complaining that ioutil.ReadDir() is deprecated. what is the updated way to do this task? π