pkg/file: Fix file.Glob to generate correct CUE structure
Closes #274
https://github.com/cuelang/cue/pull/274
GitOrigin-RevId: 45842b704d09c6a267de32664eda73a052d1bb7b
Change-Id: I3cf7077aa2c1987c18f9fddd013e8b005dc2280b
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/4880
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/pkg/tool/file/file.go b/pkg/tool/file/file.go
index b0d1e23..7514a03 100644
--- a/pkg/tool/file/file.go
+++ b/pkg/tool/file/file.go
@@ -107,5 +107,6 @@
for i, s := range m {
m[i] = filepath.ToSlash(s)
}
- return m, err
+ files := map[string]interface{}{"files": m}
+ return files, err
}
diff --git a/pkg/tool/file/file_test.go b/pkg/tool/file/file_test.go
index 6dfb17f..c9bc38f 100644
--- a/pkg/tool/file/file_test.go
+++ b/pkg/tool/file/file_test.go
@@ -133,8 +133,7 @@
if err != nil {
t.Fatal(err)
}
-
- if want := []string{"testdata/input.foo"}; !reflect.DeepEqual(got, want) {
+ if want := map[string]interface{}{"files": []string{"testdata/input.foo"}}; !reflect.DeepEqual(got, want) {
t.Errorf("got %v; want %v", got, want)
}
}