v0.9.0-alpha.3
Pre-releaseThis release includes changes to the evaluator and modules experiments, as well as a number of other improvements and fixes. A special thanks to Noam Dolovich for numerous contributions to this release!
As a reminder: users can register their projects with Unity, our regression and performance testing setup. Unity is used to ensure that a project's CUE evaluations do not unexpectedly stop working or regress in performance. Adding your project to Unity not only guarantees that we will not break your tests unexpectedly, but it also helps to improve the quality of each CUE release. Follow this link to learn more about Unity, install it, or get in touch with any questions.
Evaluator
Following the introduction of the new evaluator experiment in the last alpha release via CUE_EXPERIMENT=evalv3
, this release includes a few fixes to known bugs and panics in the new evaluator.
Subscribe to the Performance umbrella issue for updates, and see the Evaluator Roadmap project for the planned work ahead.
Modules
cue mod publish
now requires source
to publish a module, as described in Proposal 3017. The cue mod init --source
flag is added to create a new module with this field.
The cue mod edit
command is added, which allows some automatic editing of cue.mod/module.cue
from the command line.
The CUE schema for cue.mod/module.cue
is now dictated by the declared language.version
value, which is now mandatory. This allows us to change or tighten the schema with future CUE versions without breaking existing users.
CLs 1193705 and 1193706 teach cue mod publish
to include VCS metadata in published module versions, as described in Proposal 3057.
CL 1193289 teaches $CUE_REGISTRY
about a special none
registry, causing any matching modules to refuse to fetch or resolve.
As a reminder, the ongoing and planned work can be seen in the Modules Roadmap, and we continue to hold regular Modules feedback sessions.
Encodings
CLs 1193257, 1193394, 1193576, and 1193577 greatly speed up internal/filetypes
, used when loading files from disk in cue/load
or when encoding/decoding files in cmd/cue
.
CL 1193678 teaches cue/load
to cache loading files from directories, which avoids repeated work when loading parent directories to form instances.
The changes above, plus cue.Value.IsNull
below, should result in a significant speed-up for any cmd/cue
command involving many CUE packages or directories. For example, on the main CUE repository, cue fmt ./...
went from ~14s to ~0.1s, and cue vet ./...
went from ~5s to ~2s.
CL 1193639 teaches internal/filetypes
to only load its embedded CUE on first use, allowing any Go programs to skip the ~6ms load time until the first call to a cue/load
API, if any.
As a reminder, the ongoing and planned work can be seen in the Encodings Roadmap, and we also use the #encodings
channel on Slack.
Go API
CL 1193405 adds a cue.Value.IsNull
method to mirror cue.Value.Null
without constructing error values, making cue.Value.Decode
faster in many scenarios, including its use in cue/load
via internal/filetypes
.
CL 1193585 fixes a bug where cue/format
would print trailing commas for list elements after any inline comments, causing broken syntax.
CL 1193515 fixes an edge case where cue/format
would vertically align fields at different struct levels.
Builtins
CL 1193242 teaches encoding/yaml.Unmarshal
to reject trailing input, just like encoding/json.Unmarshal
already did.
CL 1184631 fixes using math.MultipleOf
as a validator function.
cmd/cue
CL 1193699 fixes a regression introduced in cue get go
in v0.8.0-alpha.1
which caused transitive package dependencies to no longer be generated.
CL 1193702 ensures that cue get go
always generates CUE code from Go time.Duration
types and values in a way that is fully compatible with Go's encoding/json
library.
CL 1193386 fixes cue fmt --simplify
to no longer break complex labels by unquoting string literals within them.
Full list of changes since v0.9.0-alpha.2
- internal/cueversion: bump fallbackVersion for v0.9.0-alpha.3 by @mvdan in 797d6f4
- Revert "cmd/cue: rip out cue.Instance and cue.Merge from 'cue cmd'" by @mvdan in 3519740
- Revert "cue: remove Merge" by @mvdan in 7195817
- cue/load: avoid repeatedly loading parent directories by caching by @NoamTD in d9c6c75
- cmd/cue: include metadata when publishing modules by @rogpeppe in b7c5800
- mod/modregistry: metadata support by @rogpeppe in cf2551f
- internal/mod/modload: retain source field when tidying by @rogpeppe in f2980b7
- cue: remove Merge by @mvdan in 1864214
- cmd/cue: rip out cue.Instance and cue.Merge from 'cue cmd' by @mvdan in 7422d00
- cmd/cue: add regression test for 'cue cmd' with many packages by @mvdan in 994a15d
- cue/testdata: reorder files in txtar by @mpvl in a16a054
- internal/core/adt: unshare once Pending arc is known by @mpvl in 61c1814
- internal/core/adt: enable comprehension.txtar by @mpvl in b3cb6e0
- cmd/cue: ensure 'get go' with time.Duration is compatible with encoding/json by @mvdan in 1c3f536
- cmd/cue: correctly extract transitive dependencies in 'get go' by @mvdan in b90a5eb
- cmd/cue: add failing tests for 'cue get go' transitive deps regression by @mvdan in 81f5a20
- internal/core/adt: add tests for structure sharing by @mpvl in 3a90b84
- internal/core/adt: catch nil parent by @mpvl in 8087ff7
- cmd/cue: implement cue mod init --source by @rogpeppe in 2ff5afa
- internal/core/adt: match decrement for nested comprehension arcs by @mpvl in edda26d
- internal/core/adt: add Sharing option in CUE_DEBUG by @mpvl in d900867
- cmd/cue: factor cue mod init source to its own file by @rogpeppe in 891a8a0
- internal/cuedebug: usurp some evaluator debug flags by @mpvl in 4280d65
- internal/cuedebug: define type for debug flags by @mpvl in 9c5c3c0
- internal/core/adt: prepare to move DebugFlags to cuedebug by @mpvl in f2e17b1
- internal/core/adt: move debug flags into struct by @mpvl in cb96718
- internal/core/adt: weave OpContext to more operations by @mpvl in 7ada2dd
- internal/filetypes: lazily load types.cue by @mvdan in 2cc7b65
- internal/filetypes: discard unknown file extensions quickly by @mvdan in f891103
- internal/filetypes: fill build.File.Filename in toFile in Go by @mvdan in 4da59d6
- internal/filetypes: simplify some of the CUE logic by @mvdan in a21e2df
- internal: remove MakeInstance by @mvdan in 25e8713
- internal/filetypes: add test coverage for FromFile unifying forms by @mvdan in c16bac7
- internal/filetypes: File.Default is indeed not unused by @mvdan in 7b2f27e
- cue: add IsNull for Decode by @mvdan in 6169eed
- cue/format: fix comments formatting in lists by @NoamTD in fdbd563
- internal/filetypes: use cue.Value.LookupPath by @mvdan in f912da6
- all: cue fmt by @mvdan in 058ab7c
- internal/encoding: resolve all deprecation warnings by @mvdan in 6f8cbb0
- cue/format: don't indent fields on same line as lbrace by @NoamTD in 0177234
- cue/format: add test for incorrect formatting by @NoamTD in 9839112
- cue/format: fix string literal replacement in labels by @NoamTD in 2d72477
- internal/_e2e: actually add source field in e2e tests by @rogpeppe in 5ea4e50
- internal/pkg: make CallCtxt.Decimal support *adt.Vertex by @NoamTD in 243df63
- cmd/cue: more resilient mod init version by @rogpeppe in a1dec7d
- internal/_e2e: fix end to end tests to set source by @rogpeppe in 7f3e9cf
- cmd/cue: fix mod edit --source self by @rogpeppe in 4997dff
- internal/vcs: use limited environment when executing git in tests by @rogpeppe in dc78c66
- internal/ci: support running e2e tests on pushes to ci/test by @rogpeppe in f0f56f8
- cue: fix small typo in function documentation by @NoamTD in 731b2af
- modresolve: support special registry "none" by @rogpeppe in d1068c4
- mod/modfile: parse module.cue according to language.version by @rogpeppe in 73b3df2
- cmd/cue: add mod edit command by @rogpeppe in b7c1a0d
- cmd/cue/cmd: require source when running cue mod publish by @rogpeppe in 0616149
- internal/vcs: new package by @rogpeppe in 87352e8
- internal/encoding/yaml: reject trailing input in Unmarshal by @mvdan in 25af2e8
- pkg/encoding: add tests that Unmarshal rejects trailing input by @mvdan in e063155
- internal/encoding/yaml: use cue/literal to quote string scalars by @mvdan in 16edd40
- internal/filetypes: avoid unifying with the top-level value by @mvdan in ff533f4
- internal/cueconfig: validate logins.json on load by @rustyx in aadc5ad