Created
May 22, 2019 15:38
-
-
Save miguelmota/488bc3c0141dc7e6967382f021c715bc to your computer and use it in GitHub Desktop.
Golang read list of files in directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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