mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-10 08:20:59 +00:00
Address new linter complaints
This commit is contained in:
@@ -172,7 +172,7 @@ func (fl *fileLoader) New(path string) (ifc.Loader, error) {
|
||||
return nil, fmt.Errorf("new root cannot be empty")
|
||||
}
|
||||
|
||||
repoSpec, err := git.NewRepoSpecFromUrl(path)
|
||||
repoSpec, err := git.NewRepoSpecFromURL(path)
|
||||
if err == nil {
|
||||
// Treat this as git repo clone request.
|
||||
if err = fl.errIfRepoCycle(repoSpec); err != nil {
|
||||
@@ -315,7 +315,7 @@ func (fl *fileLoader) Load(path string) ([]byte, error) {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode < 200 || resp.StatusCode > 299 {
|
||||
_, err := git.NewRepoSpecFromUrl(path)
|
||||
_, err := git.NewRepoSpecFromURL(path)
|
||||
if err == nil {
|
||||
return nil, errors.New("URL is a git repository")
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ func splitOnNthSlash(v string, n int) (string, string) {
|
||||
if k < 0 {
|
||||
break
|
||||
}
|
||||
left = left + v[:k+1]
|
||||
left += v[:k+1]
|
||||
v = v[k+1:]
|
||||
}
|
||||
return left[:len(left)-1], v
|
||||
@@ -367,9 +367,9 @@ func TestSplit(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewLoaderAtGitClone(t *testing.T) {
|
||||
rootUrl := "github.com/someOrg/someRepo"
|
||||
rootURL := "github.com/someOrg/someRepo"
|
||||
pathInRepo := "foo/base"
|
||||
url := rootUrl + "/" + pathInRepo
|
||||
url := rootURL + "/" + pathInRepo
|
||||
coRoot := "/tmp"
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
fSys.MkdirAll(coRoot)
|
||||
@@ -381,7 +381,7 @@ func TestNewLoaderAtGitClone(t *testing.T) {
|
||||
whatever
|
||||
`))
|
||||
|
||||
repoSpec, err := git.NewRepoSpecFromUrl(url)
|
||||
repoSpec, err := git.NewRepoSpecFromURL(url)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected err: %v\n", err)
|
||||
}
|
||||
@@ -398,13 +398,13 @@ whatever
|
||||
if _, err = l.New(url); err == nil {
|
||||
t.Fatalf("expected cycle error 1")
|
||||
}
|
||||
if _, err = l.New(rootUrl + "/" + "foo"); err == nil {
|
||||
if _, err = l.New(rootURL + "/" + "foo"); err == nil {
|
||||
t.Fatalf("expected cycle error 2")
|
||||
}
|
||||
|
||||
pathInRepo = "foo/overlay"
|
||||
fSys.MkdirAll(coRoot + "/" + pathInRepo)
|
||||
url = rootUrl + "/" + pathInRepo
|
||||
url = rootURL + "/" + pathInRepo
|
||||
l2, err := l.New(url)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
@@ -459,7 +459,7 @@ func TestLoaderDisallowsLocalBaseFromRemoteOverlay(t *testing.T) {
|
||||
// exist in its own repository, so presumably the
|
||||
// remote K would be deliberately designed to phish
|
||||
// for local K's.
|
||||
repoSpec, err := git.NewRepoSpecFromUrl(
|
||||
repoSpec, err := git.NewRepoSpecFromURL(
|
||||
"github.com/someOrg/someRepo/foo/overlay")
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected err: %v\n", err)
|
||||
@@ -533,7 +533,7 @@ func TestRepoDirectCycleDetection(t *testing.T) {
|
||||
RestrictionRootOnly, root, fSys, nil,
|
||||
git.DoNothingCloner(filesys.ConfirmedDir(cloneRoot)))
|
||||
p1 := "github.com/someOrg/someRepo/foo"
|
||||
rs1, err := git.NewRepoSpecFromUrl(p1)
|
||||
rs1, err := git.NewRepoSpecFromURL(p1)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
func NewLoader(
|
||||
lr LoadRestrictorFunc,
|
||||
target string, fSys filesys.FileSystem) (ifc.Loader, error) {
|
||||
repoSpec, err := git.NewRepoSpecFromUrl(target)
|
||||
repoSpec, err := git.NewRepoSpecFromURL(target)
|
||||
if err == nil {
|
||||
// The target qualifies as a remote git target.
|
||||
return newLoaderAtGitClone(
|
||||
|
||||
Reference in New Issue
Block a user