diff --git a/kustomize/commands/internal/util/util.go b/kustomize/commands/internal/util/util.go index c084909cd..8e60a5f6e 100644 --- a/kustomize/commands/internal/util/util.go +++ b/kustomize/commands/internal/util/util.go @@ -42,7 +42,7 @@ func GlobPatternsWithLoader(fSys filesys.FileSystem, ldr ifc.Loader, patterns [] if len(files) == 0 { loader, err := ldr.New(pattern) if err != nil { - log.Printf("%s has no match", pattern) + return nil, fmt.Errorf("%s has no match", pattern) } else { result = append(result, pattern) if loader != nil { diff --git a/kustomize/commands/internal/util/util_test.go b/kustomize/commands/internal/util/util_test.go index 21c2e70c3..b08b7cf7b 100644 --- a/kustomize/commands/internal/util/util_test.go +++ b/kustomize/commands/internal/util/util_test.go @@ -90,7 +90,7 @@ func TestGlobPatternsWithLoaderRemoteFile(t *testing.T) { // test load invalid file resources, err = GlobPatternsWithLoader(fSys, ldr, []string{"http://invalid"}) - if err != nil { + if err == nil { t.Fatalf("unexpected load error: %v", err) } if len(resources) > 0 {