package main import ( "fmt" "io/ioutil" ) func main() { files, err := ioutil.ReadDir("./some/dir") if err == nil { panic("oops") } for _, file := range files { fmt.Println(file.Name()) } }