cue/gen.go: fix bug in generation.
Change-Id: Ice79b78e07ee3d8a4a9090dd328bdeb808f61aa3
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6563
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/builtins.go b/cue/builtins.go
index 747c846..290ab79 100644
--- a/cue/builtins.go
+++ b/cue/builtins.go
@@ -149,7 +149,7 @@
var builtinPackages = map[string]*builtinPkg{
"": {
- native: []*builtin{{}},
+ native: []*builtin{},
},
"crypto/md5": {
native: []*builtin{{
@@ -3644,7 +3644,7 @@
}},
},
"tool": {
- native: []*builtin{{}},
+ native: []*builtin{},
cue: `{
Command: {
$usage?: string
@@ -3664,7 +3664,7 @@
}`,
},
"tool/cli": {
- native: []*builtin{{}},
+ native: []*builtin{},
cue: `{
Print: {
$id: *"tool/cli.Print" | "print"
@@ -3673,7 +3673,7 @@
}`,
},
"tool/exec": {
- native: []*builtin{{}},
+ native: []*builtin{},
cue: `{
Run: {
$id: *"tool/exec.Run" | "exec"
@@ -3689,7 +3689,7 @@
}`,
},
"tool/file": {
- native: []*builtin{{}},
+ native: []*builtin{},
cue: `{
Read: {
$id: "tool/file.Read"
@@ -3716,7 +3716,7 @@
}`,
},
"tool/http": {
- native: []*builtin{{}},
+ native: []*builtin{},
cue: `{
Get: Do & {
method: "GET"
@@ -3758,7 +3758,7 @@
}`,
},
"tool/os": {
- native: []*builtin{{}},
+ native: []*builtin{},
cue: `{
Name: !="" & !~"^[$]"
Value: bool | number | *string | null
diff --git a/cue/gen.go b/cue/gen.go
index cb1494a..0dcf198 100644
--- a/cue/gen.go
+++ b/cue/gen.go
@@ -124,6 +124,7 @@
// TODO: do this in a more principled way. The best is probably to
// put all builtins in a separate package.
b = bytes.Replace(b, []byte("cue."), []byte(""), -1)
+ b = bytes.Replace(b, []byte("{{}}"), []byte("{}"), -1)
if err := ioutil.WriteFile("builtins.go", b, 0644); err != nil {
log.Fatal(err)