mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-30 09:51:23 +00:00
combine fileLoader.New and NewLoader into one function: NewLoader
This commit is contained in:
@@ -53,17 +53,7 @@ func (l *fileLoader) Root() string {
|
||||
// Example: "/home/seans/project" or "/home/seans/project/"
|
||||
// NOT "/home/seans/project/file.yaml".
|
||||
func (l *fileLoader) New(newRoot string) (Loader, error) {
|
||||
if isRepoUrl(newRoot) {
|
||||
return newGithubLoader(newRoot, l.fSys)
|
||||
}
|
||||
if !l.IsAbsPath(l.root, newRoot) {
|
||||
return nil, fmt.Errorf("Not abs path: l.root='%s', loc='%s'\n", l.root, newRoot)
|
||||
}
|
||||
root, err := l.fullLocation(l.root, newRoot)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return newFileLoaderAtRoot(root, l.fSys), nil
|
||||
return NewLoader(newRoot, l.root, l.fSys)
|
||||
}
|
||||
|
||||
// IsAbsPath return true if the location calculated with the root
|
||||
|
||||
Reference in New Issue
Block a user