hakk

software development, devops, and stuff
Tree lined path

Directory

How to list files in a directory using Go [2022]

In Go there are a couple of options to list the files of a directory using the standard library. In this article you will find a list of three different methods. Note: Be aware that ioutil.ReadDir is deprecated since Go 1.16. Instead os.ReadDir should be used (shown in this article). os.ReadDir os.ReadDir is included in the standard library in the os package. Check out the documentation for more information. It’s a drop in replacement from ioutil. Read more...