Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created May 22, 2019 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save miguelmota/488bc3c0141dc7e6967382f021c715bc to your computer and use it in GitHub Desktop.
Save miguelmota/488bc3c0141dc7e6967382f021c715bc to your computer and use it in GitHub Desktop.
Golang read list of files in directory
package main
import (
"fmt"
"io/ioutil"
"log"
)
func main() {
files, err := ioutil.ReadDir("./static/")
if err != nil {
log.Fatal(err)
}
for _, file := range files {
fmt.Println(file.Name())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment