Releases: cue-lang/cue
v0.11.0-alpha.2
This release includes a new matchIf
built-in validator, many more improvements to JSON Schema and TOML support, as well as some fixes.
Evaluator
CL 1200942 adds a new matchIf
builtin, similar to matchN
, which makes it significantly easier to implement the if
, then
, and else
keywords in JSON Schema.
Modules
CL 1201493 gives a better error message when a module is not found.
CL 1201522 fixes a bug where imports did not work properly when using cue/load.Config.Package = "*"
.
Encodings
A significant amount of work has gone into improving JSON Schema support, fixing many bugs and producing better CUE output, as well as leveraging the new matchN
and matchIf
builtins. While this work is still in progress, we already expect an overall improvement compared to v0.10.0. This work will also form the basis for CUE modules for well-known services that will be published to the Central Registry.
CL 1200901 improves filetype tags, as described by cue help inputs
, so that unknown tag=value pairs cause failures, and invalid pair combinations aren't silently ignored.
CLs 1200899 and 1200924 split JSON Schema's strictness option into StrictFeatures
and StrictKeywords
which allows erroring when unimplemented features are used, but not when unknown keywords are used. --strict
is also superseded by jsonschema+strict:
.
CL 1200932 turns on JSON Schema's new StrictFeatures
option on by default, a saner default as we know which features we have not yet implemented and so the schema cannot be interpreted correctly.
CL 1201111 teaches default filetype tags to be applied in the default auto
interpretation mode as well.
CL 1201113 adds the StrictFeatures
and StrictKeywords
options to OpenAPI, mirroring the options added to JSON Schema.
CL 1200888 adds support for decoding TOML dates and times.
Builtins
CL 1201474 adds a new encoding/toml
package with Marshal
and Unmarshal
APIs, following the addition of TOML support in v0.10.0.
CL 1201115 removes strconv.ParseComplex
, which never worked in any past CUE release and does not seem like an useful API to have in its current form.
cmd/cue
CL 1201709 fixes a minor regression introduced in CUE v0.9.0 where cue help cmd mycmd ./mypkg
stopped showing a valid command's help text.
v0.11.0-alpha.1
This release includes a new matchN
built-in validator, many fixes for the new evaluator, and a significant amount of work on JSON Schema.
Evaluator
A number of crashes, regressions, and other bugs have been fixed in the new evaluator, which can be enabled by CUE_EXPERIMENT=evalv3
. For more details, see our latest performance update. Thanks to all who have tested the new evaluator and reported bugs!
CL 1198922 adds a new matchN
built-in validator, necessary implement a host of validators such as the JSON Schema equivalents of not
, oneOf
, and anyOf
. See the new how-to guide for it.
CL 1199898 relaxes the evaluator to allow referencing required fields via selectors, rather than failing like we do with optional fields. This should help with the transition of CUE schemas from regular to required fields, such as those decoded from JSON Schema.
CL 1200221 removes support for arithmetic operators on lists, and CL 1200221 teaches cue fix
to rewrite most of them. We have added a doc page with more details and examples.
CL 1199684 teaches the evaluator to allow non-concrete values to be passed as parameters to certain builtin functions such as yaml.Validate
.
CL 1199723 deduplicates errors when pairwise-combining them, as the duplication could result in large memory usage.
Modules
CL 1199541 wraps up the CUE modules experiment by dropping support for CUE_EXPERIMENT=modules=0
, now that the new mode has been the default since CUE v0.9.0, and we are not aware of any remaining regressions.
Go API
CL 1200507 deprecates astutil.Cursor.Import
, which is now superseded by astutil.Sanitize
.
Encodings
A significant amount of work has gone into improving JSON Schema support, fixing many bugs and producing better CUE output, as well as leveraging the new matchN
builtin. While this work is still in progress, we already expect an overall improvement compared to v0.10.0. This work will also form the basis for CUE modules for well-known services that will be published to the Central Registry.
CL 1199938 teaches the TOML decoder to produce CUE nodes with positions, allowing errors to include positions within TOML files.
CL 1199541 wraps up the new YAML decoder experiment by dropping support for CUE_EXPERIMENT=yamlv3decoder=0
, allowing the 8400 lines of code in internal/third_party/yaml
to be removed.
Builtins
CL 1194425 tweaks the yaml.Validate
and json.Validate
functions to allow non-concrete CUE values as schema parameters.
CL 1199602 adds a list.MatchN
function, surfacing the matchN
built-in validator for use in the JSON Schema decoder.
CL 1199881 tweaks uuid.Valid
so that it is consistent with uuid.Parse
in terms of what UUID formats are accepted.
cmd/cue
CL 1199634 drops support for the deprecated short form of cue cmd
; users of cue foo
should now call cue cmd foo
.
CL 1200351 fixes a bug in cue fix
where it would not operate on directories with multiple packages.
CL 1200498 fixes a bug in cue fix
where added imports would end up with mangled names.
CL 1200554 teaches cue fix
to work on standard input and output, like other sub-commands.
Full list of changes since v0.10.0
- internal/core/adt: add tests for validator dedupping by @mpvl in 2662ebe
- internal/core/validate: fix validation of disjunctions for evalv3 by @mpvl in 2fb6f45
- internal/ci: switch to '.yaml' workflow file extension by @myitcv in 2d329b5
- internal/core/adt: ensure pattern is evaluated by @mpvl in e97c624
- internal/core/adt: do not copy frozen flags by @mpvl in aeb3bf3
- internal/core/adt: disable non-critical panic by @mpvl in 8ebddc1
- internal/ci: set GOTOOLCHAIN=local as part of installGo by @myitcv in bb24c7c
- encoding/jsonschema: add OpenAPI 3.0 version support by @rogpeppe in d7852d7
- all: remove support for list arithmetic by @cuematthew in 46fb300
- internal/astinternal: more compact representation of relative positions by @rogpeppe in 6f4983e
- encoding/jsonschema: add keyword TODOs by @rogpeppe in 33fe828
- encoding/jsonschema: implement "not" by @rogpeppe in e7175ba
- internal/astinternal: simpler internal API by @rogpeppe in 32865bc
- cmd/cue: remove mention of CUE_EXPERIMENT=modules from help by @rogpeppe in ecbcf34
- internal/cueexperiment: prevent disabling modules experiment by @rogpeppe in a51a98f
- pkg/tool/file: use 0o777 as the default Mkdir permissions by @mvdan in a7ccc0a
- internal/envflag: support deprecated flags by @rogpeppe in 05b9b02
- all: rely on umask when creating files and directories by @mvdan in 2da59f2
- encoding/jsonschema: commit external test stats by @rogpeppe in d20e479
- encoding/jsonschema: encode oneOf etc using matchN by @rogpeppe in bfce150
- encoding/jsonschema: verify result is concrete in external tests by @rogpeppe in 2e19c1f
- encoding/jsonschema: run external tests in matrix by @rogpeppe in e2685dd
- encoding/jsonschema: prepare for matrix test runs by @rogpeppe in 9959a3e
- encoding/jsonschema: add location information to test output by @rogpeppe in 1a2e26e
- cmd/cue: support
cue fix -
to fix CUE via stdin and stdout by @mvdan in c0fdf75 - all: remove mentions of cue-sh(/tools) by @myitcv in 67443fb
- ast/astutil: deprecate Cursor.Import by @cuematthew in 691ee74
- pkg/tool/exec: Run does not exececute shell commands by @mvdan in 1e65cee
- tools/fix: avoid name-mangled imports by @cuematthew in 1440b9e
- tools/fix: correct the ast walker so sub-expressions get fixed by @cuematthew in d0617b5
- cmd/fix: allow fix to load all packages in a directory by @cuematthew in 5936450
- internal/core/compile: various fixes to matchN by @mpvl in e505402
- internal/core/adt: add tests for matchN by @mpvl in 30a8854
- encoding/jsonschema: avoid test regressions by @rogpeppe in 9956f16
- internal/core/adt: fix validators in embeddings by @mpvl in 3deadce
- internal/core/adt: add tests to prepare for bug fix by @mpvl in 0ffb5d2
- encoding/jsonschema: add external test suite by @rogpeppe in 484dd8e
- internal/cuetdtest: move testing.T out of M by @rogpeppe in 3ae664e
- cmd/cue: remove obsolete TODO about empty module paths by @mvdan in e48fb9d
- cue: remove support for legacy protobuf attributes by @mvdan in 985855f
- encoding/jsonschema: export Version by @rogpeppe in de41586
- encoding/jsonschema: move txtar tests into subdirectory by @rogpeppe in df2c869
- tools/fix: rewrite list addition and multiplication by @cuematthew in 3d36560
- encoding/toml: decode syntax tree nodes with positions by @mvdan in b123f2b
- encoding/toml: add debugprint txtar tests for the decoder by @mvdan in edc117e
- internal/astinternal: print relative positions as well by @mvdan in 6e5ec5a
- internal/astinternal: revise API with more options by @mvdan in ae3ad16
- internal/core/adt: allow referencing required fields by @mpvl in 710b438
- all: use a few more godoc links by @mvdan in a4ebf4d
- internal/core/adt: add tests for referencing required fields by @mpvl in a525801
- encoding/jsonschema: support
minContains
andmaxContains
keywords by @haoqixu in 4093ccf - cue: add a regression test for a default elimination bug fixed in evalv3 by @mvdan in dcfc2d4
- cue: add regression test for a cycle error position bug fixed in evalv3 by @mvdan in 8908d06
- pkg/list: re-test with CUE_UPDATE=1 by @mvdan in 7e29e3d...
v0.10.0
This release includes experimental support for the embed proposal, many fixes for the new evaluator and modules, as well as many other fixes and enhancements.
Evaluator
CLs 1195897, 1196094, 1198356, 1198736, and 1198860 fix crashes with CUE_EXPERIMENT=evalv3
as reported by users.
CLs 1199272, 1199273, and 1199340 fix spurious "field not allowed" error regressions in the new evaluator.
CL 1198566 fixes a performance regression introduced in CUE v0.6 where cue cmd
and tools/flow
became many times slower on some inputs.
CL 1198350 ensures that all interpreter errors, such as those from @embed
attributes, include position information.
Embed proposal
With CUE_EXPERIMENT=embed
, CUE now supports the embedding of non-CUE files within a CUE package. See the embed proposal and its design document for details, as well as the new how-to guide for the feature.
Modules
The cue help
documentation for modules and inputs has been expanded, and a number of error messages when using or publishing modules are now more helpful.
A new concept guide on CUE language versions documents the language.version
field in cue.mod/module.cue
files.
CL 1198249 adds support for an @ignore
file attribute to unconditionally ignore a file when loading packages or calculating dependencies.
CL 1198003 teaches the CUE loader to support symbolic links when loading from local directories, matching the behavior before CUE_EXPERIMENT=modules
was introduced.
CL 1198143 tweaks cue mod init
without an argument to create a module with the module path cue.example
rather than an empty path that made the module file invalid.
CL 1197530 fixes the behavior of build tags, and also adds support for parentheses in build tag expressions.
CL 1197531 implements better caching when evaluating dependencies, which should speed up evaluation of modules that use multi-directory packages.
Go API
CL 1196721 disallows importing or loading packages with an underscore qualifier like foo.com/bar:_
, as it was never intended behavior. Users should use the new embed proposal instead.
CL 1198555 adds a cue/load.Config.SkipImports
option to avoid loading instances from import statements. This particularly helps cue fmt
, where the loading caused unwanted slowness and unnecessary errors.
CL 1196820 adds a cue.LanguageVersion
function to obtain the current version of the language spec that the Go module implements.
CL 1197160 implements considered support for build tags in modules. Build tags are considered false when outside the main module.
CL 1198686 fixes cue/load
so that it no longer produces extra invalid packages when Config.Package
was set to *
and nested packages were loaded.
CL 1198351 fixes a bug in astutil.Sanitize
where unused imports were not being fully removed from ast.File
, causing errors in cue trim
where all uses of an import were removed.
CL 1198494 speeds up the Path
method on wrapped errors, which causes noticeable speed-ups in some edge cases.
CL 1198157 fixes cue/parser
to accept keywords as valid selectors, aligning with the language specification.
Encodings
Initial support for TOML is included in this release, including support in cmd/cue
and an experimental Go package. See the issue tracker for remaining work in this space.
CLs 1199309, 1199139, 1199306, 1199214, 1199398, 1199308, and 1199309 resolve a number of issues when decoding JSON Schema files.
CLs 1196332, 1199094, and 1199103 fix the JSON decoder to provide correct position information when decoding JSONL files or encountering a syntax error.
CL 1198874 fixes the loading of JSON files to reject multiple newline-delimited values, as those ar only allowed in NDJSON or JSONL files.
CL 1198876 teaches the YAML decoder to decode empty documents as null
, aligning with the YAML spec and fixing panics when loading empty YAML files.
CL 1196291 tweaks the YAML decoder so that comments following a field are attached to the entire field.
CL 1196436 tweaks the textproto decoder to correctly handle required and optional fields.
CLs 1195628 and 1199054 ensure that cue/format
prints the correct white space before and after comments.
CL 1195884 teaches cue/format
to preserve comments associated with ...
ellipsis expressions.
CL 538624 fixes a bug where cue/format
would start a CUE file with white space if it began with a clause.
CL 1196134 fixes a bug in cue/format
where a comment at the start of a CUE file would sometimes be indented.
CL 1196135 fixes a bug in cue/format
where index or selector expressions could cause extra tab indentation.
Builtins
CL 1196212 adds a list.Reverse
function to reverse the elements of a list.
CL 1197452 tweaks tool/exec.Run
so that its errors are unambiguous when any command arguments contain white space.
CL 1198636 tweaks path.Match
and tool/file.Glob
to reject **
wildcard patterns as unsupported, to avoid confusion and allow future changes to their behavior. Note that this change may break uses of **
patterns, which behaved like *
.
cmd/cue
CL 1196822 adds a --language-version
flag for cue mod init
and cue mod edit
to set the language.version
value.
CL 1197185 teaches cue mod resolve
to work on the current module when no arguments are given.
CL 1196370 teaches cue mod registry
to gracefully shut down when interrupted.
Full list of changes since v0.9.0
- all: minor code cleanups by @mvdan in dc3ba30
- internal/ci: test and release with Go 1.23.0 by @mvdan in 40da936
- cue/errors: avoid simple duplication when gathering errors by @cuematthew in ee85bb9
- cmd/cue: do not panic on empty jsonl inputs by @mvdan in 93670d7
- cmd/cue: prefer ndjson over ldjson by @mvdan in 8b3cc67
- cmd/cue: expand the embed help section by @mvdan in ecda391
- encoding/jsonschema: fix panic on impossible enum by @rogpeppe in 4760f3b
- encoding/jsonschema: fix issue 3176 by @rogpeppe in 6694c55
- encoding/jsonschema: add test case for issue 3176 by @rogpeppe in 2122b51
- encoding/jsonschema: add test cases for nested values by @rogpeppe in 0bd8619
- encoding/jsonschema: better "type excluded" logic by @rogpeppe in 7ca1a14
- encoding/jsonschema: fix type exclusion test by @rogpeppe in 5fde360
- encoding/jsonschema: add test cases for excluded types by @rogpeppe in 89c7b4b
- encoding/encoding/jsonschema: allow type number with int enum by @rogpeppe in bdf9be8
- encoding/jsonschema: only one error per URL by @rogpeppe in 8e99f5e
- encoding/jsonschema: support legacy id field by @rogpeppe in 709741d
- encoding/jsonschema: schema version support by @rogpeppe in 6c26e3c
- encoding/jsonschema: add test for numeric enum with type by @rogpeppe in 52ae410
- mod/modregistry: return empty list for Versions with invalid name by @rogpeppe in f00a023
- cmd/cue: add test for bad path lookup by @rogpeppe in 9a9dd17
- encoding/jsonschema: implement MapURL by @rogpeppe in bddcb54
- internal/core/adt: fix validator closedness issue by @mpvl in c683420
...
v0.10.0-rc.1
This release candidate includes fixes to the evaluator and various encodings.
Evaluator
CLs 1198736 and 1198860 fix two panics uncovered in the new evaluator, enabled via CUE_EXPERIMENT=evalv3
.
Encodings
CL 1198876 teaches the YAML decoder to decode empty documents as null
, aligning with the YAML spec and fixing panics when loading empty YAML files.
CL 1198831 teaches the JSON Schema encoding to decode required properties as CUE required fields.
CL 1198874 fixes the loading of JSON files to reject multiple newline-delimited values, as those ar only allowed in NDJSON or JSONL files.
CL 1199025 teaches the TOML decoder to include positions in error values.
CL 1198819 fixes the decoding of TOML keys with underscore prefixes.
Full list of changes since v0.10.0-alpha.3
- cmd/cue: add test cases for embedding files inside symlink dirs by @mvdan in 677ece8
- cmd/cue: add a test for embedding symbolic links by @mvdan in 4d941df
- cmd/cue: implement
cue import --dry-run
by @mvdan in bcbc7cd - encoding/toml: support error positions by @mvdan in 334a6fe
- encoding/toml: mimic indented CUE multi-line strings in test strings by @mvdan in 1ec257c
- update golang.org/x/... and ociregistry for rc.1 by @mvdan in c15144f
- encoding/jsonschema: decode required properties as required fields by @haoqixu in c4697bd
- all: delay compiling global regexes and templates by @mvdan in 252a666
- cmd/cue: add testscript for the jsonl file type by @mvdan in 4c7aecf
- cmd/cue: speed up get_go_json_compat.txtar by @mvdan in 20d3c9c
- cmd/cue: use fewer go/packages Need bits in
get go
by @mvdan in 3260084 - internal/encoding/yaml: decode empty inputs as "null" by @mvdan in 30a5c79
- internal/core/adt: fix panic triggered by using wrong condition by @mpvl in cd689ef
- encoding/toml: support decoding keys named "_" by @mvdan in cf18d6f
- internal/encoding: decode json files as a single JSON value by @mvdan in e8e6f04
- cmd/cue: add TOML to a couple of help topics I forgot about by @mvdan in 0dccbf3
- cmd/cue: add testscript to interpret empty files as various filetypes by @mvdan in db92bf8
- cmd/cue: fix all "flag used without being added" bugs by @mvdan in 0bd038c
- all: use simpler for loop iterations by @mvdan in 0d9d541
- internal/ci/check: bump yuin/goldmark by @mvdan in dfe07b8
- internal/core/adt: don't signal cleared schedulers by @mvdan in 0d4258e
- encoding/jsonschema: add test case for issue 3351 by @mvdan in 95c818c
- encoding/jsonschema: port txtar tests to cuetxtar by @mvdan in 44bc1ab
- internal/cuetdtest: make M.Flags (internal) public by @cuematthew in 91929bd
v0.10.0-alpha.3
This release includes fixes to the evaluator and APIs as well as initial support for the TOML encoding.
Evaluator
CL 1198356 fixes a panic in the new evaluator relating to the new mechanism for tracking closedness information.
CL 1198566 fixes a performance regression introduced in CUE v0.6 where cue cmd
and tools/flow
became many times slower on some inputs.
CL 1198350 ensures that all interpreter errors, such as those from @embed
attributes, include position information.
Encodings
Initial support for TOML is included in this release, including support in cmd/cue
and an experimental Go package. See the issue tracker for remaining work in this space.
Builtins
CL 1198636 tweaks the existing path.Match
and tool/file.Glob
builtins to reject **
wildcard patterns as unsupported, to avoid confusion and allow future changes to their behavior. Note that this change may break uses of **
patterns, which behaved like *
.
Go API
CL 1198555 adds a cue/load.Config.SkipImports
option to avoid loading instances from import statements. This particularly helps cue fmt
, where the loading caused unwanted slowness and unnecessary errors.
CL 1198686 fixes cue/load
so that it no longer produces extra invalid packages when Config.Package
was set to *
and nested packages were loaded.
CL 1198351 fixes a bug in astutil.Sanitize
where unused imports were not being fully removed from ast.File
, causing errors in cue trim
where all uses of an import were removed.
CL 1198494 speeds up the Path
method on wrapped errors, which causes noticeable speed-ups in some edge cases.
Full list of changes since v0.10.0-alpha.2
- cue/interpreter/embed: forbid
**
via pkg/path.Match by @mvdan in 187fb1a - pkg: forbid
**
in path.Match and tool/file.Glob by @mvdan in 987a85e - pkg: add test cases for ** in file patterns or globs by @mvdan in 25bb3d4
- cue/load: do not create packages unnecessarily for files outside package directory by @rogpeppe in a4abb05
- cue/load: add test case for issue 3306 by @rogpeppe in f472fd2
- cue/load: implement SkipImports mode by @rogpeppe in 88306e2
- all: make use of the new slices.Clone and cmp.Or Go 1.22 APIs by @mvdan in 55d1cb1
- internal/core/adt: use a named vertexStatus constant rather than 0 by @mvdan in 862fcf1
- cmd/cue: hook up encoding/toml for import and export by @mvdan in 9b91188
- encoding/toml: add first implementation of an encoder by @mvdan in 54f2cce
- internal/core/dep: use a new visitor.marked map when recursing by @mvdan in 34739e9
- tools/flow: add test case for issue 2559 by @mvdan in 51bf6f2
- tools/flow: add to task stats in the first initTasks call by @mvdan in bc41b25
- internal/core/runtime: do not hide positions in interpreter errors by @rogpeppe in f7b7aaf
- cmd/cue: add test case for embedded file error by @rogpeppe in bfcfff3
- internal/cuetxtar: Correct nesting of tests by @cuematthew in dc199f5
- internal/cuetxtar: Be noisier if DebugArchive is faulty by @cuematthew in b77c599
- internal/core/walk: Clarify Visitor.Before documentation by @cuematthew in aa8e810
- cmd/cue: do not initialize cmd.Command twice in
cue cmd
by @mvdan in 3f84ba6 - cmd/cue: test that
cue cmd --cpuprofile
works by @mvdan in 17b3e52 - cue/errors: make wrapped.Path faster by bypassing unnecessary reflection by @mxey in e68bd63
- all: start using Go 1.22's loop var scoping and reflect.TypeFor by @mvdan in 055405a
- internal/core/adt: do not require closeContext.group to be non-nil by @cuematthew in c8f3cad
- cmd/cue: point "help get" text at CUE-specific cmd by @jpluscplusm in 5de5b42
- cue/ast/astutil: update ast.File.Imports properly in Sanitize by @mvdan in 8145bdd
v0.10.0-alpha.2
This release includes many fixes and enhancements, particularly for modules. It also starts requiring Go 1.22 or later, as Go 1.23.0 will be released very soon.
Modules
The cue help
documentation for modules and inputs has been expanded, and a number of error messages when using or publishing modules are now more helpful.
A new concept guide on CUE language versions documents the language.version
field in cue.mod/module.cue
files.
CL 1198249 adds support for an @ignore
file attribute to unconditionally ignore a file when loading packages or calculating dependencies.
CL 1198003 teaches the CUE loader to support symbolic links when loading from local directories, matching the behavior before CUE_EXPERIMENT=modules
was introduced.
CL 1198143 tweaks cue mod init
without an argument to create a module with the module path cue.example
rather than an empty path that made the module file invalid.
Go API
CL 1198157 fixes cue/parser
to accept keywords as valid selectors, aligning with the language specification.
Full list of changes since v0.10.0-alpha.1
- cmd/cue: add tests for symbolic links by @rogpeppe in 23fc4b1
- internal/buildattr: implement
@ignore
attributes by @rogpeppe in e00557b - cmd/cue,internal/buildattr: add tests for
@ignore
tags by @rogpeppe in d502843 - internal/ci: ensure internal/_e2e isn't broken in CI by @mvdan in 00879f0
- internal/ci: ensure commit messages do not @-mention users by @mvdan in cf6641c
- cue: add a regression test for a default elimination bug fixed in evalv3 by @myitcv in 97eeee4
- internal/ci: copy how internal/vcs sets a clean env for git tests by @mvdan in 9025f67
- internal/_e2e: remove unused import by @mvdan in 6a9997f
- cue/cmd: ensure flags are added if they are used by @cuematthew in 657d5ec
- internal/ci/checks: rewrite from bash to Go by @mvdan in 32013a7
- internal/ci: move commit check script to a separate file with tests by @mvdan in daf98a0
- all: make use of some more Go 1.22 std APIs by @mvdan in af83dad
- drop go1.21, start testing on go1.23rc2 by @mvdan in 1aaf802
- cmd/cue: use default module name for cue mod init by @rogpeppe in b3c12b3
- mod/module: improve error messages for bad module path by @rogpeppe in 3e9d805
- cmd/cue: add tests for module path errors by @rogpeppe in f7e48bb
- cmd/cue: add a reference to the Central Registry from
cue help modules
by @rogpeppe in 8986233 - cmd/cue: add information about import paths to
cue help inputs
by @rogpeppe in e9bc377 - cue/parser: accept keywords as selector by @haoqixu in 682ff0e
- all: replace internal/txtarfs with txtar.FS by @mvdan in e2054df
- internal/vcs: show stderr when git exits with an error by @mvdan in d0724a0
- internal/mod/modimports: remove duplicate test txtar file entry by @mvdan in 243da87
- cue/literal: use strconv.IsGraphic by @mvdan in acdd41f
- cue/load: avoid one stat call when loading a valid module by @mvdan in efdb072
- cue/load: add test coverage for loading a legacy cue.mod file by @mvdan in 28c6219
- internal/mod/modpkgload: symbolic links can be valid CUE files too by @rogpeppe in f5b905c
- internal/mod/modpkgload: propagate CUE syntax error by @rogpeppe in a36cc32
- cmd/cue: fix panic on bad syntax by @rogpeppe in af808c3
- cmd/cue: better error message for mismatched publish version by @rogpeppe in b513fc2
- cmd/cue: improve error message for malformed module path by @rogpeppe in 9a88d06
- README: point to cuelang.org for install docs by @jpluscplusm in f2066e3
- internal: remove some deprecated type/method usages by @cuematthew in e1f552f
- cue: use Value.Err in examples using Compile APIs by @mvdan in 719893f
v0.10.0-alpha.1
This release includes initial support for the embed proposal, multiple fixes for the new modules support, as well as many other fixes and enhancements.
Evaluator
CLs 1195897 and 1196094 fix two crashes with CUE_EXPERIMENT=evalv3
as reported by users.
Embed proposal
With CUE_EXPERIMENT=embed
, CUE now supports the embedding of non-CUE files within a CUE package. See the embed proposal and its design document for details, as well as the new how-to guide for the feature.
Modules
CL 1197530 fixes the behavior of build tags, and also adds support for parentheses in build tag expressions.
CL 1197531 implements better caching when evaluating dependencies, which should speed up evaluation of modules that use multi-directory packages.
Go API
CL 1196721 disallows importing or loading packages with an underscore qualifier like foo.com/bar:_
, as it was never intended behavior. Users should use the new embed proposal instead.
CL 1196820 adds a cue.LanguageVersion
function to obtain the current version of the language spec that the Go module implements.
CL 1197160 implements considered support for build tags in modules. Build tags are considered false when outside the main module.
Encodings
CL 1195628 ensures that cue/format
prints a newline after every comment.
CL 1195884 teaches cue/format
to preserve comments associated with ...
ellipsis expressions.
CL 538624 fixes a bug where cue/format
would start a CUE file with white space if it began with a clause.
CL 1196134 fixes a bug where a comment at the start of a CUE file would sometimes be indented.
CL 1196135 fixes a bug where index or selector expressions could cause extra tab indentation.
CL 1196291 tweaks the YAML decoder so that comments following a field are attached to the entire field.
CL 1196332 tweaks the JSONL (newline-delimited JSON) so that line numbers aren't reset with each new JSON value.
CL 1196436 tweaks the textproto decoder to correctly handle required and optional fields.
Builtins
CL 1196212 adds a list.Reverse
function to reverse the elements of a list.
CL 1197452 tweaks tool/exec.Run
so that its errors are unambiguous when any command arguments contain white space.
cmd/cue
CL 1196822 adds a --language-version
flag for cue mod init
and cue mod edit
to set the language.version
value.
CL 1197185 teaches cue mod resolve
to work on the current module when no arguments are given.
CL 1196370 teaches cue mod registry
to gracefully shut down when interrupted.
Full list of changes since v0.9.0
- mod/module: allow versionless module path in CheckPath by @rogpeppe in 3a379b7
- cmd/cue: add test case for issue 3262 by @rogpeppe in 56d6987
- mod/modload: ignore _test.cue files in dependencies by @rogpeppe in 7793367
- cmd/cue: fix link in embed help text by @rogpeppe in 77ac696
- mod/modfile: use fixed language version for Fix by @rogpeppe in 6f2bfb4
- cue/load: implement shared syntax cache by @rogpeppe in fc16ef8
- cue/load: move syntax cache into fileSystem by @rogpeppe in afa222f
- cue/load: use constructor for fileSystem by @rogpeppe in f787af8
- internal/buildattr: stop at package clause and support parentheses by @rogpeppe in 5cbddef
- internal/buildattr: add tests by @rogpeppe in 1bb894b
- cue/load: CUE files only contain a single
*ast.File
by @rogpeppe in 75d4005 - cue/load: move towards unified syntax cache by @rogpeppe in 14deefa
- cue/load: remove import comment parsing by @rogpeppe in b03789f
- cue/load: clean up allTags by @rogpeppe in 59fe2e4
- interpreter/wasm,internal/filetypes: fix wasm awkwardness by @rogpeppe in d5d4815
- cue/load: cache file names only by @rogpeppe in 4a8f673
- internal/filetypes: speed up common case by @rogpeppe in fed43b0
- cmd/cue: handle signals and perform a graceful shutdown for mod registry by @haoqixu in 27adbac
- bump go-internal to get the latest testscript fixes by @mvdan in 695fefc
- cue/interpreter/embed: don't allow hidden files in glob by @mpvl in 8bedc2b
- pkg/tool/exec: document how Run.cmd works with string versus list by @mvdan in 7e1f140
- update Go dependencies for the upcoming alpha by @mvdan in f6be8a8
- internal/ci: bump Go and goreleaser versions for the upcoming alpha by @mvdan in 16c45d3
- core/adt: simplify duplicate NumKind and NumberKind consts by @cuematthew in 304530f
- pkg/tool/exec: show command arguments in errors as a Go slice by @mvdan in 38269ec
- cmd/cue: test tool/exec.Run with arguments involving spaces by @mvdan in 5903ec8
- core/adt: rename CompositKind to CompositeKind by @cuematthew in 95802d3
- cmd/cue: add a forwards compatibility test case for bugfix releases by @mvdan in 2a96988
- cue/interpreter/embed: respect module boundaries by @rogpeppe in 6056916
- README: link to Slack and Discord via cuelang.org by @jpluscplusm in ddfe8eb
- cue/interpreter/embed: require type if glob extension not specified by @myitcv in 2c8ee2f
- cue/interpreter/embed: fix handling of dir matching glob by @myitcv in 970d10f
- cmd/cue: do not allow embedding of CUE file types (for now) by @myitcv in a0f2cac
- cmd/cue: add test case for embedding of CUE file type files by @myitcv in 868c110
- cmd/cue: provide initial text for 'help embed' by @myitcv in 5c8be53
- cmd/cue: document CUE_EXPERIMENT=embed by @myitcv in e460eb0
- tools/trim: convert inline tests to txtar by @cuematthew in 8079151
- doc/ref/impl: fix order of arguments in δ partial feature function by @cuematthew in 4eecacd
- cmd/cue: make mod resolve work with no args by @rogpeppe in dbe24df
- cue/load: better treatment for build tags with respect to modules by @rogpeppe in 79c1739
- internal/buildattr: factor out from cue/load by @rogpeppe in 7ca3925
- internal/ci: remove debug logging of commit message by @myitcv in f1f0963
- cmd/cue: implement --language-version flag for cue mod edit and init by @rogpeppe in e9b2c29
- mod/modfile: deprecate LatestKnownSchemaVersion by @rogpeppe in 71eb3be
- cue: add LanguageVersion by @rogpeppe in a9009e8
- cue/interpreter/embed: add support for embedding by @mpvl in 6594f45
- cue/ast,spec: document that
package _
is equivalent to missing package by @rogpeppe in c7f9334 - disallow explicit underscore import path qualifiers by @rogpeppe in 1c381a0
- cue/load: do not consider anonymous packages when checking package qualifier by @rogpeppe in 5ab2d73
- cmd/cue,cue/load: add tests for underscore packages by @rogpeppe in 9295a20
- internal/core/runtime: new attribute name for extern by @mpvl in b70e543
- internal/filetypes: split ParseFile by @mpvl in a1c1cd7
- pkg/list: add Reverse function by @NoamTD in f42327c
- cue/load: clarify the docs for Config.ModuleRoot by @mvdan in a94d22f
- README: simplify a bit, add new website links, add Discord invite by @mvdan in fecf80d
- encoding/protobuf/textproto: correctly decode required/optional fields by @haoqixu in dec1786
- encoding/json: fix position for jsonl by @haoqixu in 16c15d1
- remove navbar.md and its supporting logo by @mvdan in 0d69846...
v0.9.2
This release includes a fix for a regression around CUE files without a package name, and updates the compiled-in language version to match the actual tagged version v0.9.2.
CL 1196785 fixes the cue/load
logic to correctly take CUE files with out a package name into account (issue #3244).
Full list of changes since d8742c1
v0.9.1
This release includes a few fixes, mainly relating to CUE_EXPERIMENT=modules
being enabled by default in v0.9.0.
Modules
CLs 1196176 and 1196180 allow using and developing a module whose cue.mod/module.cue
lacks a major version suffix like @v0
, as adding one may break older CUE versions without CUE_EXPERIMENT=modules
.
CL 1196156 adds a cue/load.Config.AcceptLegacyModules
option to allow loading CUE modules without a language.version
field, given that the field was only introduced in v0.8.0.
CL 1196178 fixes a regression where loading a package with the cue/load.Config.Package
option set was no longer working as expected.
As a reminder, we are maintaining an FAQ page which should help modules users with the upgrade to v0.9.
Builtins
CL 1195888 fixes the path.Match
API so that it can actually take the three parameters it expects.
v0.9.0
This release includes major changes to Modules and the Evaluator, as well as many other fixes and improvements. A special thanks to Noam Dolovich for numerous contributions to this release!
Modules
Following the Modules proposal v3 being accepted, the modules experiment is now enabled by default in this release. It should no longer be necessary to set CUE_EXPERIMENT=modules
, and CUE_EXPERIMENT=modules=0
can be used to disable the experiment. We are not aware of any significant regressions, so please file a bug if you find one.
We have published an FAQ page which should help modules users with the upgrade to v0.9. We will add to this page over the coming weeks to ease the transition into the "new" modules mode.
This release also includes experimental support for the CUE Central Registry at https://registry.cue.works. We have added a cue login
command to log into the Central Registry via a GitHub account, and other commands know how to use these credentials when talking to the registry.
To get started with the Central Registry, we have published a tutorial on working with modules and the central registry as well. We will share more details about the Central Registry and support for other login mechanisms in the future. For now, we are looking to get early feedback.
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. Use the new cue mod fix
command to add the field.
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.
cue mod publish
now includes VCS metadata in published module versions, as described in Proposal 3057.
The cue mod fix
command is added, which allows fixing up old cue.mod/module.cue
files; see cue help mod fix
.
The cue mod edit
command is added, which allows some automatic editing of cue.mod/module.cue
from the command line; see cue help mod edit
.
CL 1193289 teaches $CUE_REGISTRY
about a special none
registry, causing any matching modules to refuse to fetch or resolve.
CL 1195546 teaches cue mod publish
to include a LICENSE
file from the VCS repository root if the CUE module subdirectory has none.
CL 1194090 adds the --dryrun
, --json
, and --out
flags to cue mod publish
to inspect what would be published as part of a module version.
CL 1194106 adds the cue mod resolve
command to show how a module path resolves to a registry in the form of an OCI reference.
CL 1185280 adds cue help modules
as a high-level overview of CUE modules.
CL 1194669 restricts the parsing of cue.mod/module.cue
files to data-only mode, forbidding any references or comprehensions which may break cue mod
commands or cause other issues.
As a reminder, the ongoing and planned work can be seen in the Modules Roadmap.
Evaluator
The new evaluator can now be enabled in the command line via CUE_EXPERIMENT=evalv3
, and in the Go API via cuecontext.EvaluatorVersion(cuecontext.EvalV3)
. The new evaluator already includes a new disjunction algorithm as well as initial structure sharing support; note that structure sharing can be disabled with CUE_DEBUG=sharing=false
.
The work is not yet complete, and some known bugs remain, but over 95% of the existing tests are passing and the performance already looks promising. Work on this new evaluator will continue during the next release cycle. We will only turn on the new evaluator by default once we are reasonably confident that there are no significant regressions.
CL 1185458 ensures we detect permanent errors for undefined fields earlier, necessary for the permanent errors fix in tools/flow
below.
Subscribe to the Performance umbrella issue for updates, and see the Evaluator Roadmap project for the planned work ahead.
Encodings
The Encodings project was kicked off at a recent CUE Community Update call. As part of this, we now have an #encodings
channel on Slack and Discord, as well as an Encodings Roadmap project on GitHub where the ongoing and planned work can be seen.
In this release, the new YAML decoder is available in experimental form and enabled by default, given that all of our tests are already passing. You can disable it via CUE_EXPERIMENT=yamlv3decoder=0
. The old YAML decoder will be removed in a future release once we're reasonably confident that no significant regressions are present.
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 cmd/cue
as well as cue/load
when loading 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.
CL 1195047 fixes the decoding of YAML 1.1 octal numbers so that they no longer result in invalid CUE literals.
cmd/cue
CL 1189314 adds a cue fmt --check
flag to list badly formatted files rather than modifying them directly.
CL 1193778 adds a cue fmt --diff
flag which displays diffs instead of updating files.
CL 1193962 adds a cue fmt --files
flag to interpret the arguments as file paths to walk and recursively format rather than package patterns.
CL 1192180 speeds up cue fmt
by ensuring that it only processes each CUE file once, rather than formatting files from parent directories as well.
CL 1185356 tweaks cue/load
so that cue fmt
is able to format CUE files given directly as arguments even when they belong to different packages.
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.
CL 1193934 improves cue fmt
so that it does not write to files on disk which are already well formatted.
CL 1194247 tweaks cue help
so that it correctly fails when given unknown help topics or commands.
CL 1185473 deprecates the short-form cue somecmd
in favor of cue cmd somecmd
, as the former caused a number of bugs and slowness when working out which subcommand to execute.
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 1191227 adds a cue/token.File.Lines
getter method, much like go/token.File.Lines
was added in Go 1.21.
CL 1193030 ensures that cue/load.Instances
always returns instances in a deterministic order, in particular when multiple instances share the same directory.
CL 1194421 fixes a memory leak where using load.Instances
to load CUE modules would increase the size of a global cue.Context
until the process was terminated.
CL 1187452 teaches tools/flow
to fail when a task encounters a permanent error, which were being ignored before.
CL 1191226 teaches cue/literal.ParseNum
to support both positive and negative signs for consistency.
CL 1194410 fixes cue/load
so that it errors on empty string arguments once again.
CL 1193515 fixes an edge case where cue/format
would vertically align fields at different struct levels.
CL 1193585 fixes a bug where cue/format
would print trailing commas for list elements after any inline comments, causing broken syntax.
CL 1193759 teaches cue/format
to collapse empty lists and structs to a si...