21 lines
256 B
Go
21 lines
256 B
Go
package helper
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
)
|
|
|
|
func IsEmpty(path string) (bool, error) {
|
|
f, err := os.Open(path)
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
defer f.Close()
|
|
|
|
_, err = f.Readdirnames(1)
|
|
if err == io.EOF {
|
|
return true, err
|
|
}
|
|
return false, err
|
|
}
|