Skip to content

Commit

Permalink
Rename resourceGetter to remoteTargetGetter for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
yujunz committed Mar 24, 2020
1 parent 51b29d7 commit a0e7abb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 112 deletions.
12 changes: 6 additions & 6 deletions api/loader/fileloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ type fileLoader struct {

// If this is non-nil, the files were
// obtained from the given resource
rscSpec *resourceSpec
rscSpec *remoteTargetSpec

// Used to get resources
getter resourceGetter
getter remoteTargetGetter

// Used to clean up, as needed.
cleaner func() error
Expand Down Expand Up @@ -134,14 +134,14 @@ func newLoaderOrDie(
log.Fatalf("unable to make loader at '%s'; %v", path, err)
}
return newLoaderAtConfirmedDir(
lr, root, fSys, nil, git.ClonerUsingGitExec, getResource)
lr, root, fSys, nil, git.ClonerUsingGitExec, getRemoteTarget)
}

// newLoaderAtConfirmedDir returns a new fileLoader with given root.
func newLoaderAtConfirmedDir(
lr LoadRestrictorFunc,
root filesys.ConfirmedDir, fSys filesys.FileSystem,
referrer *fileLoader, cloner git.Cloner, getter resourceGetter) *fileLoader {
referrer *fileLoader, cloner git.Cloner, getter remoteTargetGetter) *fileLoader {
return &fileLoader{
loadRestrictor: lr,
root: root,
Expand Down Expand Up @@ -179,7 +179,7 @@ func (fl *fileLoader) New(path string) (ifc.Loader, error) {
return nil, fmt.Errorf("new root cannot be empty")
}

ldr, errGet := newResourceGetter(path, fl.fSys, nil, fl.cloner, fl.getter)
ldr, errGet := newLoaderAtGetter(path, fl.fSys, nil, fl.cloner, fl.getter)
if errGet == nil {
return ldr, nil
}
Expand Down Expand Up @@ -215,7 +215,7 @@ func (fl *fileLoader) New(path string) (ifc.Loader, error) {
// directory holding a cloned git repo.
func newLoaderAtGitClone(
repoSpec *git.RepoSpec, fSys filesys.FileSystem,
referrer *fileLoader, cloner git.Cloner, getter resourceGetter) (ifc.Loader, error) {
referrer *fileLoader, cloner git.Cloner, getter remoteTargetGetter) (ifc.Loader, error) {
cleaner := repoSpec.Cleaner(fSys)
err := cloner(repoSpec)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions api/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func NewLoader(
lr LoadRestrictorFunc,
target string, fSys filesys.FileSystem) (ifc.Loader, error) {

ldr, errGet := newResourceGetter(target, fSys, nil, git.ClonerUsingGitExec, getResource)
ldr, errGet := newLoaderAtGetter(target, fSys, nil, git.ClonerUsingGitExec, getRemoteTarget)
if errGet == nil {
return ldr, nil
}
Expand All @@ -31,12 +31,12 @@ func NewLoader(
if errGit == nil {
// The target qualifies as a remote git target.
return newLoaderAtGitClone(
repoSpec, fSys, nil, git.ClonerUsingGitExec, getResource)
repoSpec, fSys, nil, git.ClonerUsingGitExec, getRemoteTarget)
}

root, errDir := demandDirectoryRoot(fSys, target)
if errDir == nil {
return newLoaderAtConfirmedDir(lr, root, fSys, nil, git.ClonerUsingGitExec, getResource), nil
return newLoaderAtConfirmedDir(lr, root, fSys, nil, git.ClonerUsingGitExec, getRemoteTarget), nil
}

return nil, fmt.Errorf("Error creating new loader with git: %v, dir: %v, get: %v", errGit, errDir, errGet)
Expand Down
103 changes: 0 additions & 103 deletions api/loader/resource.go

This file was deleted.

0 comments on commit a0e7abb

Please sign in to comment.