Replace os.Stat with IsDir, simplifying FS abstraction.

This commit is contained in:
Jeffrey Regan
2018-07-18 11:33:30 -07:00
parent 8fda0f87ab
commit 9432671887
15 changed files with 83 additions and 69 deletions

View File

@@ -70,11 +70,9 @@ func (o *addResourceOptions) Complete(cmd *cobra.Command, args []string) error {
// RunAddResource runs addResource command (do real work).
func (o *addResourceOptions) RunAddResource(fsys fs.FileSystem) error {
_, err := fsys.Stat(o.resourceFilePath)
if err != nil {
return err
if !fsys.Exists(o.resourceFilePath) {
return errors.New(o.resourceFilePath + " does not exist")
}
mf, err := newKustomizationFile(constants.KustomizationFileName, fsys)
if err != nil {
return err