diff --git a/pkg/cmdutil/args.go b/pkg/cmdutil/args.go index ae7e9e956b0..196621b823c 100644 --- a/pkg/cmdutil/args.go +++ b/pkg/cmdutil/args.go @@ -67,8 +67,10 @@ func GlobWindowsPaths(patterns []string) ([]string, error) { if err != nil { return nil, fmt.Errorf("%s: %v", pattern, err) } - if len(matches) != 0 { + if len(matches) > 0 { expansions = append(expansions, matches...) + } else { + expansions = append(expansions, pattern) } } diff --git a/pkg/cmdutil/args_test.go b/pkg/cmdutil/args_test.go index b47a64db675..60a37c29532 100644 --- a/pkg/cmdutil/args_test.go +++ b/pkg/cmdutil/args_test.go @@ -71,9 +71,9 @@ func TestGlobWindowsPaths(t *testing.T) { wantErr: nil, }, { - name: "When no files match, it returns an empty expansions array", + name: "When no files match, it returns an empty expansions array, it returns the unmatched patterns", patterns: []string{"foo", "bar"}, - wantOut: []string{}, + wantOut: []string{"foo", "bar"}, wantErr: nil, }, {