package main import ( "io" "os" ) func checkDir(dirName string) (bool, error) { f, err := os.Open(dirName) if err != nil { return false, err } defer f.Close() _, err = f.Readdirnames(1) if err == io.EOF { return true, nil } return false, err }