airshipctl/pkg/util/util.go
2019-05-06 13:58:58 -05:00

15 lines
258 B
Go

package util
import (
"os"
)
// IsReadable returns nil if the file at path is readable. An error is returned otherwise.
func IsReadable(path string) error {
f, err := os.Open(path)
if err != nil {
return err.(*os.PathError).Err
}
return f.Close()
}