v0.16.0-alpha.2
Changes which may break some users are marked below with: ⚠️
Language
As a reminder, we have two ongoing language experiments since v0.15; a replacement for struct embedding and a rework of aliases. Please give these a try and report any issues or feedback!
The new try experiment
This experiment adds a try clause in comprehensions as well as the use of ? in field selectors. This addition to the language intends to provide a more concise syntax for handling optional fields without the risk of unintentionally swallowing errors.
You can try this experiment by following our how-to guide. For more information, see the proposal on GitHub and the spec change patch.
The new else comprehension clause
This change adds an optional else clause for CUE modules targetting the language version v0.16.0 or later. With this addition to the language, an if or for comprehension may be followed by an else clause which triggers when the comprehension produces zero values.
Note that this feature is not an experiment; it is available to any CUE module targetting the language version v0.16.0 or later.
You can try this feature by following our how-to guide. For more information, see the full patch which includes the changes to the spec, or read the pre-release version of the language spec.
Evaluator
A number of changes were made to improve support for using cue.Values concurrently; see Issue #2733 for more details and ongoing progress.
A number of panics and other bugs in the evaluator which were reported since v0.15.0 have been fixed; thank you to all who reported these.
cmd/cue
The global --verbose and --trace flags have been moved to the cue get go and cue trim commands respectively, as they were the only ones actually using those flags, and this could be confusing to users.
Fix a bug where loading ./...:pkgname could lead to loading directories with zero CUE files as instances, which could cause poor performance for CUE packages with multiple parent directories.
LSP server
Code Actions: two code actions are now provided, Add surrounding struct braces and Remove surrounding struct braces, which convert between
a: b: c
and
a: {
b: c
}
with the cursor on b.
Initial LSP support for editing embedded JSON files. This feature provides completions and hover-docs when editing JSON files which are embedded into CUE via the @embed attribute. A teaser video is available on YouTube. Support for embedded YAML files will appear soon.
Several bug fixes, including better behaviour for files and directories with spaces; improvements for value aliases (foo: L=x); LSP rename now provides placeholder text.
See our Getting Started wiki page for instructions on how to set it up with your editor.
Please report any bugs or missing features you encounter via the Issue tracker or via the #lsp channels on Discord or Slack.
Encodings
Add support for encoding YAML tags like key: !Custom value by using CUE attributes like key: "value" @yaml(,tag="!Custom").
Standard library
The net package adds CompareIP to compare two IP addresses, which can be useful for computing with IP ranges.
The net/http package adds Serve as an experimental API to listen on a port and serve HTTP requests.
The tool/file package adds Symlink to create symbolic links.
Go API
cue/ast gains the NewPredeclared and Ident.IsPredeclared to mark and detect identifiers referencing predeclared names like error or int rather than fields which may shadow those names in the current scope.
⚠️ cue/token.Compare now sorts absolute paths before relative ones, to ensure consistent behavior between Unix-like systems and Windows.
⚠️ The long-deprecated and hidden cue.Instance.Eval method is now removed.
All changes
104 changes since v0.16.0-alpha.1by area
all6
allstart using "else" in comprehensionsalluse reflect.TypeAssert in three more placesallre-applygo fix -any=false ./...after Go version bumpallapply the straightforward Go 1.25 or later cleanupsalltest and release on Go 1.26, require Go 1.25 or laterallgo fix -any=false ./...
cmd10
cmd/cueadd and unskip tests for invalid task type errorscmd/cue/cmdadd test coverage for absolute packages with cue cmdcmd/cuedeflake cue_after testcmd/cue/cmdadd failing test for issue #4202cmd/cuerewrite help fmtcmd/cuealter flag behavior based on the command namecmd/cuedrop --verbose and --trace as global flagscmd/cuemap constants by go/types.Type directlycmd/cuetest thatcue fmtalso formats files with no package clausecmd/cuerewrite help vet
cue18
cue/testdataupdate stats for comprehensions/try.txtarcue/buildintegrate identifier resolution into Completecue/ast,cue/ast/astutiladd NewPredeclared and IsPredeclared for builtin referencescue/loadimprove error for major-only version packages outside a modulecueclarify that Schema is only useful for Value.Subsumecue/loaddo not load non-CUE directories as instancescue/loadadd test case for non-package directoriescue/internalMake ToFile optionally preserve StructLitscue/ast,cue/ast/astutiladd Predeclared sentinel for builtin referencescue/ast/astutilfix false positive in label expression check for let clausescue/testdataadd regression test for issue #4203cue/errorsavoid duplicate path in error list formattingcue/testdata/builtinsadd test for error() with erroring interpolationcue/testdata/disjunctionsadd regression test for value alias in disjunctioncue/testdata/cycleadd regression test for issue 4244cue/tokensort absolute positions before relative onescueremove Instance.Evalcuepoint out cue/format exists in the godoc
encoding3
encoding/gocodefix testencoding/yamladd support for YAML tags via@yaml(,tag)attributeencoding/jsonextract PatchExpr to internal/encoding/json
internal35
internal/core/exportfix self-referential lets for recursive definitionsinternal/core/compileavoid double error for invalid optional referencesinternal/core/adtadd regression test for error() in pattern constraint keysinternal/core/adtfix structural cycle hang with braced selectorsinternal/core/depfix stack overflow on recursive definitions in dep analysisinternal/core/dep,internal/core/exportfix stack overflow on recursive definitionsinternal/coreremove import path to instance mappinginternal/ciexplicitly set contents permissioninternal/core/adtimplement try expressionsinternal/core/adtfix else clause duplication in comprehension field splittinginternal/astinternalomit ILLEGAL tokens in debug printinternal/cidisable checkout persist-credentials by defaultinternal/core/exportfix panic in relPathLength for BinaryExprinternal/core/exportavoid let name collisions with dependency fieldsinternal/core/exportadd failing test for issue #4221internal/core/adtfix undefined field in comprehension with structural cycleinternal/core/adtfix panic in memory reclamationinternal/core/adtadd else clause to comprehensionsinternal/core/exportfix hidden identifier renaming in for clausesinternal/core/exportadd failing test for issue #4254internal/lspimplement ConvertFromStruct code actioninternal/cibump actions/checkout and cue.dev/x/githubactionsinternal/core/runtimeadd lock protection to loaded mapinternal/core/adtfix race condition in Vertex.Default()internal/core/adtuse thread-safe WeakMap for regexp cachinginternal/lspmodel embedded files as packagesinternal/lspFileEvaluatorForURI returns lsp/cache.Fileinternal/core/compilefix operator precedence in error() builtininternal/core/adtfix value alias resolution in disjunctionsinternal/core/adthandle EqualOp in SimplifyBoundsinternal/lspimplement ConvertToStruct code actioninternal/core/adtrefine cycle handling in LetReference.resolveinternal/ciallow steps to influence job permissionsinternal/cifix release workflowinternal/ciuse new registry-login-action
lsp13
lsp/evalAdd support for try-clauses and optional path componentslsp/fscacheignore ASTs which have no absolute positionslsp/cacheexpand completion range of fields in json for double-quoteslsp/cachecompletions must not return null items listlsp/evalfix field-value aliaseslsp/evaladd test to show bad behaviour of aliaseslsp/serverforce-load all packages for completions within embedded fileslsp/evalprocess field attributes and specialise queries for embedslsp/fscacheread json and yaml files as CUElsp/cacherework package dirtying and reloadinglsp/evalchange eval constructor to take Config structlsp/fscachecorrect path componentslsp/cacheprovide placeholder for PrepareRename
pkg7
pkg/list/testdataadd regression test for issue #4171pkg/tools/httpremove valueMu mutex from http.Servepkg/tools/httpexperimental implementation of http.Servepkg/netadd CompareIPpkg/encoding/openapisupport marshalSchema builtin for openAPIpkg/tool/fileadd Symlinkpkg/pathremove osInfo.HasPrefix
tools3
tools/flowskip phantom tasks from eliminated conditional branchestools/fixuse ast.Predeclared to avoid shadowing in value alias conversiontools/fixadd tests for value alias conversion when "self" is in scope
Other9
- update all dependencies
doc/specuse "custom errors" instead of "user errors"- tweak Claude's allow and deny settings further
_scriptsadd OpenSpec support for AI-assisted developmentgolps/protocolintroduce DocumentURI.Path methodgopls/protocolrename DocumentURI.Path to DocumentURI.FilePathinterpreter/embedprepare embed for extensionintegration/workspaceadd test showing bad behaviour- add
go tool cueandxargsas allowed Claude commands
Downloads
Every file this release published on GitHub, with its SHA-256. Most people install CUE as Installing CUE describes, which also shows how to check a download.
Archives
| Platform | File and SHA-256 |
|---|---|
| macOS, Intel | cue_5f87d6689dd6f2780331d3bdcd3cc82d11d4310a2a6b97d75cd4876b5786a3d1 |
| macOS, Apple silicon | cue_0b14d69979cb5f846d3e1aeeffc976ba63b5f4de3ace3d2e13001feadea87cad |
| Linux, x86-64 | cue_419688b77f32b00dba767d6778c730c1333b56f37ea52c4b87f808047283286d |
| Linux, Arm64 | cue_a56b5d2a61edf468dfd508fbd5b52375a1685e3cef9cc8a612049f172da56937 |
| Windows, x86-64 | cue_dd89b28aee5258c0cb22cf579e091e8790e1c9845967c18a18a41af36e01fc6d |
| Windows, Arm64 | cue_9bdd930c190f0a20690218348a5f288c6dd641b25710073f5905b6ea49782fab |