diff --git a/kustomize/commands/edit/add/addresource_test.go b/kustomize/commands/edit/add/addresource_test.go index 928c89cfc..d35f16262 100644 --- a/kustomize/commands/edit/add/addresource_test.go +++ b/kustomize/commands/edit/add/addresource_test.go @@ -103,5 +103,5 @@ func TestAddResourceFileNotFound(t *testing.T) { args := []string{resourceFileName} err := cmd.RunE(cmd, args) - assert.EqualError(t, err, "pattern "+resourceFileName+" has no match: must build at directory: not a valid directory: '"+resourceFileName+"' doesn't exist") + assert.EqualError(t, err, resourceFileName+" has no match: must build at directory: not a valid directory: '"+resourceFileName+"' doesn't exist") } diff --git a/kustomize/commands/internal/util/util.go b/kustomize/commands/internal/util/util.go index d13b6a529..aa42e3213 100644 --- a/kustomize/commands/internal/util/util.go +++ b/kustomize/commands/internal/util/util.go @@ -55,7 +55,7 @@ func GlobPatternsWithLoader(fSys filesys.FileSystem, ldr ifc.Loader, patterns [] loader, err := ldr.New(pattern) if err != nil { - return nil, fmt.Errorf("pattern %s has no match: %w", pattern, err) + return nil, fmt.Errorf("%s has no match: %w", pattern, err) } result = append(result, pattern) diff --git a/kustomize/commands/internal/util/util_test.go b/kustomize/commands/internal/util/util_test.go index 11038b3e0..16fae2660 100644 --- a/kustomize/commands/internal/util/util_test.go +++ b/kustomize/commands/internal/util/util_test.go @@ -76,7 +76,7 @@ func TestGlobPatternsWithLoaderRemoteFile(t *testing.T) { invalidURL := "http://invalid" resources, err = GlobPatternsWithLoader(fSys, ldr, []string{invalidURL}, false) require.Error(t, err, "expected error but did not receive one") - require.Equal(t, "pattern "+invalidURL+" has no match: "+invalidURL+" not exist", err.Error(), "unexpected load error") + require.Equal(t, invalidURL+" has no match: "+invalidURL+" not exist", err.Error(), "unexpected load error") require.Equal(t, 0, len(resources), "incorrect resources") // test load unreachable remote file with skipped verification