)// From: http://stackoverflow.com/questions/30697324/how-to-check-if-directory-on-path-is-emptyfuncDirIsEmpty(namestring)(bool,error){f,err:=os.Open(name)iferr!=nil{returnfalse,err}deferf.Close()_,err=f.Readdirnames(1)// Or f.Readdir(1)iferr==io.EOF{returntrue,nil}returnfalse,err// Either not empty or error, suits both cases}