Skip to content

Commit

Permalink
ioutil.ReadDir depricated and replaced with os.ReadDir
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorsvill committed Feb 20, 2025
1 parent 6b14a70 commit 5f6c9e2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
)
Expand Down Expand Up @@ -53,7 +52,7 @@ func main() {
}

func walkDirJSON(path string, parent *DirEntry) {
files, _ := ioutil.ReadDir(path)
files, _ := os.ReadDir(path)
for _, file := range files {
entry := &DirEntry{Name: file.Name(), IsDir: file.IsDir()}
parent.Entries = append(parent.Entries, entry)
Expand All @@ -64,7 +63,7 @@ func walkDirJSON(path string, parent *DirEntry) {
}

func walkDir(path string, level int, prefix string, w io.Writer) {
files, _ := ioutil.ReadDir(path)
files, _ := os.ReadDir(path)
for i, file := range files {
if i == len(files)-1 {
fmt.Fprintf(w, "%s└── %s\n", prefix, file.Name())
Expand Down

0 comments on commit 5f6c9e2

Please sign in to comment.