mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Merge pull request #342 from Liujingfang1/master
remove dependency on internal error
This commit is contained in:
@@ -30,7 +30,6 @@ import (
|
|||||||
|
|
||||||
"github.com/kubernetes-sigs/kustomize/pkg/constants"
|
"github.com/kubernetes-sigs/kustomize/pkg/constants"
|
||||||
"github.com/kubernetes-sigs/kustomize/pkg/fs"
|
"github.com/kubernetes-sigs/kustomize/pkg/fs"
|
||||||
interror "github.com/kubernetes-sigs/kustomize/pkg/internal/error"
|
|
||||||
"github.com/kubernetes-sigs/kustomize/pkg/types"
|
"github.com/kubernetes-sigs/kustomize/pkg/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -89,22 +88,17 @@ func newKustomizationFile(mPath string, fsys fs.FileSystem) (*kustomizationFile,
|
|||||||
|
|
||||||
func (mf *kustomizationFile) validate() error {
|
func (mf *kustomizationFile) validate() error {
|
||||||
if !mf.fsys.Exists(mf.path) {
|
if !mf.fsys.Exists(mf.path) {
|
||||||
errorMsg := fmt.Sprintf("Missing kustomization file '%s'.\n", mf.path)
|
return fmt.Errorf("Missing kustomization file '%s'.\n", mf.path)
|
||||||
merr := interror.KustomizationError{KustomizationPath: mf.path, ErrorMsg: errorMsg}
|
|
||||||
return merr
|
|
||||||
}
|
}
|
||||||
if mf.fsys.IsDir(mf.path) {
|
if mf.fsys.IsDir(mf.path) {
|
||||||
mf.path = path.Join(mf.path, constants.KustomizationFileName)
|
mf.path = path.Join(mf.path, constants.KustomizationFileName)
|
||||||
if !mf.fsys.Exists(mf.path) {
|
if !mf.fsys.Exists(mf.path) {
|
||||||
errorMsg := fmt.Sprintf("Missing kustomization file '%s'.\n", mf.path)
|
return fmt.Errorf("Missing kustomization file '%s'.\n", mf.path)
|
||||||
merr := interror.KustomizationError{KustomizationPath: mf.path, ErrorMsg: errorMsg}
|
|
||||||
return merr
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !strings.HasSuffix(mf.path, constants.KustomizationFileName) {
|
if !strings.HasSuffix(mf.path, constants.KustomizationFileName) {
|
||||||
errorMsg := fmt.Sprintf("Kustomization file path (%s) should have %s suffix\n",
|
return fmt.Errorf("Kustomization file path (%s) should have %s suffix\n",
|
||||||
mf.path, constants.KustomizationFileSuffix)
|
mf.path, constants.KustomizationFileSuffix)
|
||||||
return interror.KustomizationError{KustomizationPath: mf.path, ErrorMsg: errorMsg}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user