diff --git a/content/en/docs/references/spec.md b/content/en/docs/references/spec.md index 21a8a8bf3c..f66bbf87fd 100644 --- a/content/en/docs/references/spec.md +++ b/content/en/docs/references/spec.md @@ -1171,9 +1171,9 @@ A dynamic field may be marked as optional or required. ``` Expression Result -a: "foo a: "foo" +a: "foo" a: "foo" b: "bar" b: "bar" -(a): "baz" bar: "baz" +(a): "baz" foo: "baz" (a+b): "qux" foobar: "qux" @@ -2630,7 +2630,7 @@ LetClause = "let" identifier "=" Expression . ``` a: [1, 2, 3, 4] -b: [ for x in a if x > 1 { x+1 } ] // [3, 4, 5] +b: [for x in a if x > 1 { x+1 }] // [3, 4, 5] c: { for x in a diff --git a/content/en/docs/tutorials/kubernetes.md b/content/en/docs/tutorials/kubernetes.md index 0e3019a32e..4cb758c17d 100644 --- a/content/en/docs/tutorials/kubernetes.md +++ b/content/en/docs/tutorials/kubernetes.md @@ -1,4 +1,4 @@ --- type: redirect -redirectURL: https://github.com/cue-lang/cue/blob/v0.6.0/doc/tutorial/kubernetes/README.md +redirectURL: https://github.com/cue-lang/cue/blob/v0.7.0/doc/tutorial/kubernetes/README.md --- \ No newline at end of file diff --git a/content/en/docs/tutorials/tour/expressions/coalesce.md b/content/en/docs/tutorials/tour/expressions/coalesce.md index 8dc819409f..cef0d26539 100644 --- a/content/en/docs/tutorials/tour/expressions/coalesce.md +++ b/content/en/docs/tutorials/tour/expressions/coalesce.md @@ -7,10 +7,10 @@ layout = "tutorial" +++ @@ -33,7 +33,7 @@ the result is not of the desired type. coalesce.cue

{{< highlight go >}} -list: [ "Cat", "Mouse", "Dog" ] +list: ["Cat", "Mouse", "Dog"] a: *list[0] | "None" b: *list[5] | "None" diff --git a/content/en/docs/tutorials/tour/expressions/fieldcomp.md b/content/en/docs/tutorials/tour/expressions/fieldcomp.md index a425ed723f..5d53ddaa75 100644 --- a/content/en/docs/tutorials/tour/expressions/fieldcomp.md +++ b/content/en/docs/tutorials/tour/expressions/fieldcomp.md @@ -19,7 +19,7 @@ Instead, one must use indexing. {{< highlight go >}} import "strings" -#a: [ "Barcelona", "Shanghai", "Munich" ] +#a: ["Barcelona", "Shanghai", "Munich"] for k, v in #a { "\( strings.ToLower(v) )": { diff --git a/content/en/docs/tutorials/tour/expressions/listcomp.md b/content/en/docs/tutorials/tour/expressions/listcomp.md index 5ef74e57cc..1be189e29f 100644 --- a/content/en/docs/tutorials/tour/expressions/listcomp.md +++ b/content/en/docs/tutorials/tour/expressions/listcomp.md @@ -16,7 +16,7 @@ The example shows the use of `for` loops and `if` guards. listcomp.cue

{{< highlight go >}} -[ for x in #items if x rem 2 == 0 { x*x } ] +[for x in #items if x rem 2 == 0 { x*x }] #items: [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] diff --git a/content/en/docs/tutorials/tour/intro/validation.md b/content/en/docs/tutorials/tour/intro/validation.md index d6accd4537..3e910e470b 100644 --- a/content/en/docs/tutorials/tour/intro/validation.md +++ b/content/en/docs/tutorials/tour/intro/validation.md @@ -43,7 +43,7 @@ languages: {{< highlight txt >}} languages.1.name: invalid value "dutch" (out of bound =~"^\\p{Lu}"): ./schema.cue:3:8 - ./data.yaml:5:12 + ./data.yaml:5:11 {{< /highlight >}} \ No newline at end of file diff --git a/content/en/pkg.go.dev.md b/content/en/pkg.go.dev.md index 17eb785a9c..85fee4ff53 100644 --- a/content/en/pkg.go.dev.md +++ b/content/en/pkg.go.dev.md @@ -1,4 +1,4 @@ --- type: redirect -redirectURL: https://pkg.go.dev/cuelang.org/go@v0.6.0 +redirectURL: https://pkg.go.dev/cuelang.org/go@v0.7.0 --- \ No newline at end of file diff --git a/go.mod b/go.mod index 4b8893b2cc..e0e2d6638d 100644 --- a/go.mod +++ b/go.mod @@ -3,19 +3,19 @@ module github.com/cue-lang/cuelang.org go 1.20 require ( - cuelang.org/go v0.6.0 + cuelang.org/go v0.7.0 github.com/apex/gateway v1.1.2 github.com/aws/aws-lambda-go v1.32.1 github.com/rogpeppe/testscript v1.1.0 - golang.org/x/mod v0.9.0 + golang.org/x/mod v0.13.0 ) require ( - github.com/cockroachdb/apd/v3 v3.2.0 // indirect + github.com/cockroachdb/apd/v3 v3.2.1 // indirect github.com/google/uuid v1.2.0 // indirect github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect github.com/pkg/errors v0.9.1 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/net v0.16.0 // indirect + golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 129a750b96..be27fe194e 100644 --- a/go.sum +++ b/go.sum @@ -1,19 +1,20 @@ -cuelang.org/go v0.6.0 h1:dJhgKCog+FEZt7OwAYV1R+o/RZPmE8aqFoptmxSWyr8= -cuelang.org/go v0.6.0/go.mod h1:9CxOX8aawrr3BgSdqPj7V0RYoXo7XIb+yDFC6uESrOQ= +cuelabs.dev/go/oci/ociregistry v0.0.0-20231103182354-93e78c079a13 h1:zkiIe8AxZ/kDjqQN+mDKc5BxoVJOqioSdqApjc+eB1I= +cuelang.org/go v0.7.0 h1:gMztinxuKfJwMIxtboFsNc6s8AxwJGgsJV+3CuLffHI= +cuelang.org/go v0.7.0/go.mod h1:ix+3dM/bSpdG9xg6qpCgnJnpeLtciZu+O/rDbywoMII= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/apex/gateway v1.1.2 h1:OWyLov8eaau8YhkYKkRuOAYqiUhpBJalBR1o+3FzX+8= github.com/apex/gateway v1.1.2/go.mod h1:AMTkVbz5u5Hvd6QOGhhg0JUrNgCcLVu3XNJOGntdoB4= github.com/aws/aws-lambda-go v1.17.0/go.mod h1:FEwgPLE6+8wcGBTe5cJN3JWurd1Ztm9zN4jsXsjzKKw= github.com/aws/aws-lambda-go v1.32.1 h1:ls0FU8Mt7ayJszb945zFkUfzxhkQTli8mpJstVcDtCY= github.com/aws/aws-lambda-go v1.32.1/go.mod h1:jwFe2KmMsHmffA1X2R09hH6lFzJQxzI8qK17ewzbQMM= -github.com/cockroachdb/apd/v3 v3.2.0 h1:79kHCn4tO0VGu3W0WujYrMjBDk8a2H4KEUYcXf7whcg= -github.com/cockroachdb/apd/v3 v3.2.0/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc= +github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg= +github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emicklei/proto v1.10.0 h1:pDGyFRVV5RvV+nkBK9iy3q67FBy9Xa7vwrOTE+g5aGw= -github.com/go-quicktest/qt v1.100.0 h1:I7iSLgIwNp0E0UnSvKJzs7ig0jg/Iq83zsZjtQNW7jY= +github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -26,12 +27,14 @@ github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de h1:D5x39vF5KCwKQaw+OC9ZPiLVHXz3UFw2+psEX+gYcto= github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de/go.mod h1:kJun4WP5gFuHZgRjZUWWuH1DTxCtxbHDOIJsudS8jzY= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/image-spec v1.1.0-rc4 h1:oOxKUJWnFC4YGHCCMNql1x4YaDfYBTS5Y4x/Cgeo1E0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/protocolbuffers/txtpbfmt v0.0.0-20230328191034-3462fbc510c0 h1:sadMIsgmHpEOGbUs6VtHBXRR1OHevnj7hLx9ZcdNGW4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.11.1-0.20231026093722-fa6a31e0812c h1:fPpdjePK1atuOg28PXfNSqgwf9I/qD1Hlo39JFwKBXk= github.com/rogpeppe/testscript v1.1.0 h1:NxTsoOBQ1zibxf6NDtzrjPbK56hDAteIcOTSINZHtow= github.com/rogpeppe/testscript v1.1.0/go.mod h1:lzMlnW8LS56mcdJoQYkrlzqOoTFCOemzt5LusJ93bDM= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -43,14 +46,14 @@ github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8 github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk= github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk= github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= -golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= +golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/play/go.mod b/play/go.mod index 6112c6da12..fadb60c694 100644 --- a/play/go.mod +++ b/play/go.mod @@ -3,18 +3,20 @@ module github.com/cue-sh/playground go 1.20 require ( - cuelang.org/go v0.6.0 - github.com/cockroachdb/apd/v3 v3.2.0 - golang.org/x/text v0.8.0 + cuelang.org/go v0.7.0 + github.com/cockroachdb/apd/v3 v3.2.1 + golang.org/x/text v0.13.0 ) require ( + cuelabs.dev/go/oci/ociregistry v0.0.0-20231103182354-93e78c079a13 // indirect github.com/emicklei/proto v1.10.0 // indirect github.com/google/uuid v1.2.0 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.0-rc4 // indirect github.com/protocolbuffers/txtpbfmt v0.0.0-20230328191034-3462fbc510c0 // indirect - golang.org/x/mod v0.9.0 // indirect - golang.org/x/net v0.8.0 // indirect + golang.org/x/net v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/play/go.sum b/play/go.sum index 134c032c9b..816dd34649 100644 --- a/play/go.sum +++ b/play/go.sum @@ -1,10 +1,12 @@ -cuelang.org/go v0.6.0 h1:dJhgKCog+FEZt7OwAYV1R+o/RZPmE8aqFoptmxSWyr8= -cuelang.org/go v0.6.0/go.mod h1:9CxOX8aawrr3BgSdqPj7V0RYoXo7XIb+yDFC6uESrOQ= -github.com/cockroachdb/apd/v3 v3.2.0 h1:79kHCn4tO0VGu3W0WujYrMjBDk8a2H4KEUYcXf7whcg= -github.com/cockroachdb/apd/v3 v3.2.0/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc= +cuelabs.dev/go/oci/ociregistry v0.0.0-20231103182354-93e78c079a13 h1:zkiIe8AxZ/kDjqQN+mDKc5BxoVJOqioSdqApjc+eB1I= +cuelabs.dev/go/oci/ociregistry v0.0.0-20231103182354-93e78c079a13/go.mod h1:XGKYSMtsJWfqQYPwq51ZygxAPqpEUj/9bdg16iDPTAA= +cuelang.org/go v0.7.0 h1:gMztinxuKfJwMIxtboFsNc6s8AxwJGgsJV+3CuLffHI= +cuelang.org/go v0.7.0/go.mod h1:ix+3dM/bSpdG9xg6qpCgnJnpeLtciZu+O/rDbywoMII= +github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg= +github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc= github.com/emicklei/proto v1.10.0 h1:pDGyFRVV5RvV+nkBK9iy3q67FBy9Xa7vwrOTE+g5aGw= github.com/emicklei/proto v1.10.0/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A= -github.com/go-quicktest/qt v1.100.0 h1:I7iSLgIwNp0E0UnSvKJzs7ig0jg/Iq83zsZjtQNW7jY= +github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -16,17 +18,21 @@ github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQ github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de h1:D5x39vF5KCwKQaw+OC9ZPiLVHXz3UFw2+psEX+gYcto= github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de/go.mod h1:kJun4WP5gFuHZgRjZUWWuH1DTxCtxbHDOIJsudS8jzY= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.0-rc4 h1:oOxKUJWnFC4YGHCCMNql1x4YaDfYBTS5Y4x/Cgeo1E0= +github.com/opencontainers/image-spec v1.1.0-rc4/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= github.com/protocolbuffers/txtpbfmt v0.0.0-20230328191034-3462fbc510c0 h1:sadMIsgmHpEOGbUs6VtHBXRR1OHevnj7hLx9ZcdNGW4= github.com/protocolbuffers/txtpbfmt v0.0.0-20230328191034-3462fbc510c0/go.mod h1:jgxiZysxFPM+iWKwQwPR+y+Jvo54ARd4EisXxKYpB5c= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= +github.com/rogpeppe/go-internal v1.11.1-0.20231026093722-fa6a31e0812c h1:fPpdjePK1atuOg28PXfNSqgwf9I/qD1Hlo39JFwKBXk= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= +golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/play/internal/cuelang_org_go_internal/encoding/encoder.go b/play/internal/cuelang_org_go_internal/encoding/encoder.go index e3e6d73eb5..16805f6181 100644 --- a/play/internal/cuelang_org_go_internal/encoding/encoder.go +++ b/play/internal/cuelang_org_go_internal/encoding/encoder.go @@ -19,6 +19,7 @@ import ( "encoding/json" "fmt" "io" + "io/fs" "os" "path/filepath" @@ -300,17 +301,27 @@ func writer(f *build.File, cfg *Config) (_ io.Writer, close func() error, err er } return cfg.Stdout, nil, nil } - if !cfg.Force { - if _, err := os.Stat(path); err == nil { - return nil, nil, errors.Wrapf(os.ErrExist, token.NoPos, - "error writing %q", path) - } - } - // Delay opening the file until we can write it to completion. This will - // prevent clobbering the file in case of a crash. + // Delay opening the file until we can write it to completion. + // This prevents clobbering the file in case of a crash. b := &bytes.Buffer{} fn := func() error { - return os.WriteFile(path, b.Bytes(), 0644) + mode := os.O_WRONLY | os.O_CREATE | os.O_EXCL + if cfg.Force { + // Swap O_EXCL for O_TRUNC to allow replacing an entire existing file. + mode = os.O_WRONLY | os.O_CREATE | os.O_TRUNC + } + f, err := os.OpenFile(path, mode, 0o644) + if err != nil { + if errors.Is(err, fs.ErrExist) { + return errors.Wrapf(fs.ErrExist, token.NoPos, "error writing %q", path) + } + return err + } + _, err = f.Write(b.Bytes()) + if err1 := f.Close(); err1 != nil && err == nil { + err = err1 + } + return err } return b, fn, nil } diff --git a/play/internal/cuelang_org_go_internal/filetypes/types.go b/play/internal/cuelang_org_go_internal/filetypes/types.go index 3b66cb9c07..5eb7307b13 100644 --- a/play/internal/cuelang_org_go_internal/filetypes/types.go +++ b/play/internal/cuelang_org_go_internal/filetypes/types.go @@ -44,5 +44,5 @@ func cuegenMake(name string, x interface{}) cue.Value { return v } -// Data size: 1708 bytes. -var cuegenInstanceData = []byte("\x01\x1f\x8b\b\x00\x00\x00\x00\x00\x00\xff\xc4X\xddo\xe4\xb6\x11\x97|W\xa0R\xd3>\xe6\xad\xc0\x9c\xae\bR\xe3*#\x1f@\x81\x05\x8cC\u047b+\xee\xa5)\x8a\xf4)\b\f\xae4\xdae#\x91*I%6\xe2}h\x9b\xa6\xfd\xab\xb3\u0150\x94(je\xfb\f\xa4\xa8_\xbc;?\xcepf8\x9f\xfb\xf3\xe3\xbf\xcf\u04b3\xe3\x7f\x92\xf4\xf8\x8f$\xf9\xed\xf1\xefO\xd2\xf4=.\xb4a\xa2\xc2W\xcc0\xa2\xa7O\u04a7\x7f\x96\u04a4gI\xfa\xf4O\xcc\xec\xd3\xf7\x92\xf4'ox\x8b:=~\x9f$\xc9/\x8f\xff:K\xd3_|\xf1e5`\xd9\xf0\xd6s~\x9f\xa4\xc7\xef\x92\xe4\xc3\xe3?\x9f\xa4\xe9O\x03\xfd\xbb$=K\x9f\xfe\x91uH\x82\x9eZb\x9e$\xc9\x0f\xef\xff\x8a4I\u04f34\xcd\xccM\x8f\xba\xac\x06L\x7fx\xffg=\xab\xbeb;\x84\xed\xc0\xdb:\xcf/.\xe0w@\xf7C%\x95B\xddKQk0\x12\x18\xfcA\xbaC%\xc1e\xfe\x9c\xfem\xe0\xdb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xmPh\x17\x12\xf6tQ\xfeUKQ\xf8o\x8b\x1c&\x1d\xd8`\xe4\xa4\xc4\xc1\xb1\u0730\xae},\xcb\xe38\x0e\x94\xf7\x19^St\xcd\x1c~\xf5\u045a\u02fdS\xcfW]\xbe\x04\x1fp\xb9\xf5\xc6\xfd>\xbf\xfa\xe8\x01\xafS>\a\x9f\x1f\xf2L\x0e\xbd\x89\x02\xe7\xea\xe3\x1f\u01ce\xb9V\x1f?V+\xfc\x9a\xea@\xd0\xe9\x93\xff\xb5o\x1f\x0e\xe7\xabO\x1e0\xa2\xe1\x94\xf2s+jl\xe6F|\xfa\xff\xcf\u026bO\x1f\x99\x95c\x87{=&'t\xac\u05ee\x99\x84\x84\xa5\xf2\xe5\u02e1\x83zEe\xd0p\xaa~\x8b\xbc.\x8ay\x97\xbd\u02b3\x82\x86\x83\x89H\xfd\x96\byH\xff@'\xc2\b\xb4\x1e\x99\x80\x96\x90\xb6\x0eL1\"\xeeD|\xc9\b\u0488\x90O\x85a\x050\xd7&\x06\f^\x1b\x02v2Xg\x81\x9d$r\xaf\xa4\x91s}-\xc1J\xc2k3\xa2\x93\xa4\x18\xdd\xcet\x0eh\x9eQK\xf9\xec\xd5g\x1b C4\xfe\xed\x85%\x15\xe5\xc801m\xb9\xe8\xb7pq\x01[.\x98\xba\xe9\xb7\u04e80\x0eH\xc0E\xcd+\u05d5\xdc\x03R40c[\x9b\xc2^\xa1FA\xe3\n0z\u069db]\x99O\xe3\xd5\x06\x9e]\x16\x85\x13) \x1e\xac\xa0F\x83\xaa\x9b\xcd!\x15*\u00f8\x18\xe5\x80\xde\u02e1\xad\xa9\xfbE\xd3\xc8\xc5\x05\xbc\x91\n\xc6\x11\xf6\x05\xd8\x1a\u0471\x9b\xc5I`\u0509u\xa5\xf8\xd6\xe9\xe7\"\xf8\x05|\xb3\xe7\xd5\x1e\xb8\xd1\xd86\xb6s2A\xac\x95\x14_\xa32\xae\xe52\xf8\xfd_^{\x8e2_\u0304\u04d8g'\xc1y\xd0zzcG\xd2hd\x1cG\xaf\u0160V4R\xbahv\x83\xa6\xe3*\xdc\u0145\x7f\x0ez+\x97]\x95\xec:\x1a\xcfZ.\u0411\x8d<\xcd+\x02lF91.\x99\x9d\xf4I2\xa5\xf0N\xb1~\x1f\xa1\x96\xe2\xc0\x9a\xed\"\xa8f\xbb\x110l\x81\x18/\xd0\u058bo\xf3y\xed\xb1\xa5\u01c2d\xe5\t\xeaM\xf7p\xbb\x8a\xb7\xee\x00\xa5\xd8\tn3\xd4\xc26\xf8Op\x97A\xf6\xc0\x94!'\x87B\xaa\xd1A\x9b,\xfd\x96&b;\xa9#7{T\xe4\xe81\x17|\xba\xc0(\xe2\x05\xc8\b\u03f3~\xbb\x81\xf3\xf8\x16\xf7W\x8c\x99V\xe4\xa7#EA\xf7\xc3-\xac1>\xbb\xbc\x9f\u0552\xbd\x95\xab\x06\x16\u04c3Y=\u00a39\xb1'<\x8e|'\xd7\xee\u010d\xde@\xda!\xee2.\x9b\"3\xcbZf\xaf\u0651\xd3}W$\xd6\x1fE\uae05y\xb94\xa89\xfc\x84\xdd\xcep+\x17F3\x95\x8f\xcey6\x9d\b\n\a\xdeE\x9c\xecQ\xb0\x9e\xdf!\u02e3\xef \xc8\xd5\a\u06e0\xa7\xa5\xce7j*\u042cm\x1dX\xc2[\x03\xb5D\rB\x1a\xe0\xa2j\x87\x1a\xddN)U\ao_\x95\xb9=g\x15\xb2\x1b-\xed\xee\x97\xd3Z;\xd5/\xab=5\uaaf5\xea\x02\x93\x96\xde\x15p\v\x85\x9d~\uc9f1\xba,\x96\xad\xe5@\x16\xafl\xcbI'^\x10\x97h\xbc*~\x18\xc1\xbf\x86\x0f\x96\x94<[,\x92Ky\xf1J\xb9D\xe3Er\x81\x1e\xa8\u038bqZ\x9d\x0fQ'\xfe\xf2>:\xb9o\u076a \xff\xa4\x80\x87\ap\xbe&\xafS\xe1v\xffm\xee.\x16w\xd2\xf9\xc4\xe7\ubfbeW\x9b\x85\x1f\xd7\xfd\xb7\xee\xb7`O\xd4stim\x98\xd9\xf6\xec2\x84\xd0\xf8#\u009cy\u0797hu\xd8-\xfd\xf2\xec\u04b7\xb1X\xdbQ\xad\xe8W\x8b\u026e\xf9\xaf\x15\xab\x06\xac\xfae\xd2\xeb\x90\xc7S\xf5\xd4#\xc7$\b\x16\x84\x0e\x19\x96\x9fE\xb6\xb8$\x81\xdb\xf1\xdd\xe6\v\u00e8\xc7|O\b\xc2C\xfb\x8c\x9d\x1b\xa9Ai\xe8$\xc7\x1dyU\x9f\xe9`\xe89\xab\xe7\x82\x0e\xf3V\xf3\xc0Q#\xbb\xfb\xee\x0e\ag-}\x91c\xef4\x06D\xd2\xef\x98\tf/\xb0\xb4\x85\x1a\xfd}b\xe6={MJhy\v\xe5O\f=\xe4q\x9fxD\xad\xb6\u02d4k\x82\xf1-\u02eev\xa7\x03\xef\xed_\xef\u0335\xea\xace4\x1d\xf2$\xf9o\x00\x00\x00\xff\xff\x85i\xbeS\xb4\x16\x00\x00") +// Data size: 1703 bytes. +var cuegenInstanceData = []byte("\x01\x1f\x8b\b\x00\x00\x00\x00\x00\x00\xff\xc4X\u074b\xe4\xc6\x11\x97\xf6.\x105N\x1e\ry\b\xd4\xe9\xc08\xcbE\x8b?\xc8\xc3\xc0r\x84\xdc]\xb8\x978\x04\xe7\u0258\xa1G*\xcdt,u+\xdd-{\x17\xef\x90\xc4q\xf2g{Cu\xb7\u0512F\xbb{\v\x0e\u0797\x9d\xa9_WuUu}\xce/n\xffs\x96\x9e\xdd\xfe7Io\xff\x99$\xbf\xfb\u01d34}OHc\xb9,\xf1\x15\xb7\x9c\xc8\xe9\x93\xf4\xe9_\x94\xb2\xe9Y\x92>\xfd3\xb7\x87\xf4\xbd$\xfd\xd9\x1b\u0460Io\xbfO\x92\xe4\u05f7\xff>K\xd3_~\xf1e\xd9cQ\x8b&p~\x9f\xa4\xb7\xdf%\u0247\xb7\xffz\x92\xa6?\x8f\xf4\xef\x92\xf4,}\xfa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ia\xbf\x1cw\u0671~9\xed\xa9;o\u05ea\v\x8cZ\x06W\xc0\r\xe4n\xe4q\x9f\x86\xea\xb2\u0630\x96S\xd8|O[\x8e7\xf3\xadp\x89\xce\xf7\xc3\x0fg\xf0o\xe0\x83%\x85e\x8b\xedq)o\xbeG.\xd1\xf9\xf6\xb8@\x8fT\xe7\xe50\xa2N'\xa7\x13\x7f\x05\x1f\x9d\u0737nU\x94\x7fR\xc0\xe3\x03x_\x93\u05e9p\xfb\xff.w\x17\xdb:\xe9|\xe2\xf3u_\u07eb\xcd\u008f\xeb\xfe[\xf7[\xb4g\xd6sL\xe1l\x98\xd8\xf6\xec2\x86\xd0\xf0\xcb\xc1\x94y\u0697h_\xd8/\xfd\xf2\xec2\xb4\xb1\xb9\xb6\x83Z\xb3\x9f*F\xbb\xa6?Q\xac\x1a\xb0\xea\x97Q\xaf#\x9b\x8f\xd2c\x8f\x1c\x92 Z\x10;d\xdcx\x16\xd9\xe2\x93\x04n\x86w\x9bn\t\x83\x1e\xd3\xe5 \n\x8f\xeds\xee\u0719\x1a\x94\x86^\xf2\xbc#\xaf\xea3\x1e\x8c=g\xf5\\\xd4a\xdaj\x1e8jU{\xdf\xdd\xf1\u0925/r\xec\x9d\u0180\x99\xf4;f\x82\xc9\v,m\xa1F\x7f\x9f\x98i\xcf^\x93\x12[\xdeB\xf9\x13C\x8fl\xde'\x1eQ\xab\xdd\x06\xe5\x9b\xe0\xfc\x96eW\xbb\u04c1\xf7\xf6\xafw\xe6Zu\xd62\x9a\x8e,I\xfe\x17\x00\x00\xff\xffj\xd7\xe3\u00e8\x16\x00\x00") diff --git a/play/internal/cuelang_org_go_internal/internal.go b/play/internal/cuelang_org_go_internal/internal.go index 64f2f64ee3..d83e5943d9 100644 --- a/play/internal/cuelang_org_go_internal/internal.go +++ b/play/internal/cuelang_org_go_internal/internal.go @@ -264,9 +264,8 @@ func NewAttr(name, str string) *ast.Attribute { buf.WriteByte('@') buf.WriteString(name) buf.WriteByte('(') - fmt.Fprintf(buf, str) + buf.WriteString(str) buf.WriteByte(')') - return &ast.Attribute{Text: buf.String()} } diff --git a/play/internal/cuelang_org_go_internal/third_party/yaml/decode.go b/play/internal/cuelang_org_go_internal/third_party/yaml/decode.go index ac4088d5f6..796dd9b5aa 100644 --- a/play/internal/cuelang_org_go_internal/third_party/yaml/decode.go +++ b/play/internal/cuelang_org_go_internal/third_party/yaml/decode.go @@ -236,6 +236,8 @@ func (p *parser) sequence() *node { } if len(n.children) > 0 { n.endPos = n.children[len(n.children)-1].endPos + } else { + n.endPos = p.event.start_mark } p.expect(yaml_SEQUENCE_END_EVENT) return n @@ -362,7 +364,7 @@ func (d *decoder) attachLineComment(m yaml_mark_t, pos int8, expr ast.Node) { } func (d *decoder) pos(m yaml_mark_t) token.Pos { - pos := d.p.info.Pos(m.index+1, token.NoRelPos) + pos := d.absPos(m) if d.forceNewline { d.forceNewline = false @@ -390,7 +392,7 @@ func (d *decoder) pos(m yaml_mark_t) token.Pos { } func (d *decoder) absPos(m yaml_mark_t) token.Pos { - return d.p.info.Pos(m.index+1, token.NoRelPos) + return d.p.info.Pos(m.index, token.NoRelPos) } func (d *decoder) start(n *node) token.Pos { diff --git a/play/internal/cuelang_org_go_internal/third_party/yaml/scannerc.go b/play/internal/cuelang_org_go_internal/third_party/yaml/scannerc.go index 831a5c6400..fb0d95d7f2 100644 --- a/play/internal/cuelang_org_go_internal/third_party/yaml/scannerc.go +++ b/play/internal/cuelang_org_go_internal/third_party/yaml/scannerc.go @@ -489,10 +489,11 @@ func cache(parser *yaml_parser_t, length int) bool { // Advance the buffer pointer. func skip(parser *yaml_parser_t) { - parser.mark.index++ + w := width(parser.buffer[parser.buffer_pos]) + parser.mark.index += w parser.mark.column++ parser.unread-- - parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) + parser.buffer_pos += w } func skip_line(parser *yaml_parser_t) { @@ -503,11 +504,12 @@ func skip_line(parser *yaml_parser_t) { parser.unread -= 2 parser.buffer_pos += 2 } else if is_break(parser.buffer, parser.buffer_pos) { - parser.mark.index++ + w := width(parser.buffer[parser.buffer_pos]) + parser.mark.index += w parser.mark.column = 0 parser.mark.line++ parser.unread-- - parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) + parser.buffer_pos += w } } @@ -528,7 +530,7 @@ func read(parser *yaml_parser_t, s []byte) []byte { s = append(s, parser.buffer[parser.buffer_pos:parser.buffer_pos+w]...) parser.buffer_pos += w } - parser.mark.index++ + parser.mark.index += w parser.mark.column++ parser.unread-- return s diff --git a/play/src/components/gen_cuelang_org_go_version.ts b/play/src/components/gen_cuelang_org_go_version.ts index e097498ae7..4fb8700eff 100644 --- a/play/src/components/gen_cuelang_org_go_version.ts +++ b/play/src/components/gen_cuelang_org_go_version.ts @@ -1 +1 @@ -export const CUEVersion = "v0.6.0"; +export const CUEVersion = "v0.7.0";