v0.17.0-alpha.1
Changes which may break some users are marked below with: ⚠️
Language
The active try experiment renames the new fallback keyword, used with for comprehensions, to otherwise. fallback continues to be accepted for now, but is rewritten to the new form.
The active aliasv2 experiment now allows ~(X) as an alternative to ~X for the single postfix alias form. ~X is also rewritten as ~(X) for the sake of consistency and clarity.
Language versions v0.17.0 and later allow omitting commas in multi-line lists. Just like a newline after a struct field implies a comma, a newline after a list element now implies a comma as well.
The language spec is tweaked to make $ a valid identifier, which was already allowed by the parser and evaluator.
⚠️ Support for the infix div, mod, quo, and rem operators has been removed. Since late 2020, these infix forms have been undocumented and rewritten by cue fix to the new function calls.
The new shortcircuit experiment
This release introduces the shortcircuit experiment, which changes the && and || operators to not evaluate the right operand if the left operand alone determines the result.
This matches the behavior already documented in the CUE spec and is consistent with most mainstream languages, but for the sake of a smooth transition for end users, we are rolling out this change via an experiment.
You can try this experiment via the @experiment(shortcircuit) file attribute. To mimic the old behavior with the experiment, you can use a hidden field:
_y: Y
if X && _y {}
Evaluator
Fix a number of issues where cue def could produce invalid CUE output, such as due to name conflicts.
Fix an evaluator regression where embedded disjunctions across packages may not correctly apply closedness.
Fix an evaluator bug where cue.Context.BuildExpr of close({}) did not actually result in a closed struct.
Fix a bug where some calls to standard library functions or validators did not include the “error in call to pkg.Func” error context, or included it twice.
A few changes to the evaluator should reduce allocated objects by up to 16%, reducing GC overhead and memory usage.
cmd/cue
The new global -C or --chdir flag runs cue from the given working directory.
cue import --path now skips over null values in an input stream, such as empty documents in a YAML file.
The new cue exp gengotypes --outfile flag controls the output file path when generating a single package.
LSP server
Add an initial version of organize-imports, which sorts the existing imports and removes unneeded imports. It is not yet capable of suggesting missing imports.
Wait for a short period of inactivity before sending diagnostics to the editor. This “debounce” means that a user typing incomplete CUE syntax will not be distracted with syntax errors as much.
The aliasv2 experiment is now fully supported.
The rename function is fixed to distinguish between field names and aliases.
Improve field name analysis in general so that fields with multiple aliases (e.g. v=[k=string]: _) are properly supported.
Improve attribute handling for file-level embedded attributes, and to attach attributes within expressions to the correct struct.
Treat conjunctions (&) and disjunctions (|) the same way for goto-definition. With the cursor on a path, it returns all results that the path MAY resolve to. With the cursor on a field declaration name, it returns all results that the path constructed from the field’s name, and its field’s name (and so on) MAY resolve to.
Special-case close function calls so that paths can resolve through fields within the argument to close.
Encodings
The JSON Schema decoder is improved to better handle the prefixItems keyword.
The JSON Schema encoder is improved to support list.UniqueItems and standalone validators, to use maxItems and minItems instead of maxLength and minLength for lists with prefix elements, and to generate description keywords for doc comments.
Standard library
The net IP APIs now consistently return an error on invalid input types.
strconv.FormatFloat now accepts a string format parameter, like FormatFloat(3.14, "e", 4, 64).
list.MatchN now shows what expected value it’s matching against when it fails.
Go API
Using cue.Values concurrently is now fully supported, which required deprecating cue.Value.Context. If you encounter any races or bugs, please report them.
cue/load now supports loading from an io/fs.FS, as outlined in proposal #4285. Loading file embeds through Config.Overlay and Config.FS is supported now as well.
cue/ast/astutil deprecates Sanitize in favor of the new SanitizeFiles API, given that Sanitize on a single file cannot know if another file in the same package shadows builtin names like self.
Clarify that cue/format indents with a tab width of 4 by default.
A new fuzzer has been introduced in the cue package, checking that the parser doesn’t crash and that its results are consistent with the rest of the Go APIs like cue/literal. So far, it has already resulted in seventeen bug fixes.
The cue.Interpreter option API has been deprecated in favor of cue.WithInjection, which is a better name going forward.
⚠️ cue/ast.File.Imports, deprecated in mid 2025 in favor of cue/ast.File.ImportSpecs, is now removed.
⚠️ The long-deprecated and hidden cue.Instance methods Lookup, LookupDef, LookupField, and Fill are now removed.
All changes
342 changes since v0.16.0by area
all10
alluse slices and maps iterators for collect-and-sort patternsalluse strings.SplitSeq and strings.Cut to avoid intermediate slicesallfix stray and misplaced doc commentsallallow newlines around interpolations in single-line stringsalladopt cueckoo guidance SessionStart hookallrename fallback keyword to otherwiseallremove support for infix div, mod, quo, and remalluse cue/ast.File.Preamble in two more placesallremove some unused code spotted by staticcheckallstop using XXX for examples and tests
cmd30
cmd/cue/cmdadd regression test for hidden fields like _5cmd/cue/cmdadd regression test for vet list.Contains errorscmd/cue/cmddocument wrong nested-module behavior for issue 2707cmd/cuelist user-defined commands in cue cmd --helpcmd/cueadd -C flag, likegoandgitcmd/cueadd regression test for ranged numeric type namescmd/cuetest that package paths outside the module are rejectedcmd/cuemake tests pass with Go at tip (1.27) againcmd/cue/cmduse goproxytest.Setup for per-test proxy modulescmdfix link to issue 2031cmd/cueadd a regression test for issue #1595cmd/cueadd regression test for issue #1783cmd/cueadd regression test for issue #1834cmd/cueadd regression test for issue #2575cmd/cueprint error and benchmark results with CUE_BENCHcmd/cuetest CUE_STATS_FILE and CUE_BENCH on failing evaluationscmd/cueadd exp gengotypes --outfilecmd/cueswap BuildFile for BuildExpr in --pathcmd/cueadd edge case tests for embed attributescmd/cueadd testscript for #2648cmd/cuereuse astutil.ToFile for --path expressionscmd/cueskip over null when importing with --pathcmd/cueadd tests for issue 3464cmd/cueadd tests for bad version and qualifier in import pathscmd/cuesuggest docker/podman login when OAuth2 device flow is unsupportedcmd/cueadd testscript for cue login when device code endpoint is unsupportedcmd/cueclarify how to authenticate with standard OCI registriescmd/cueadd gengotypes test for conditional narrowing of a type referencecmd/cuereturn an error for non-label --path expressions instead of panickingcmd/cueadd test for package qualifier in subdirectories
cue111
cue/ast/astutildeprecate Sanitize in favor of SanitizeFilescue/testdata/cycleadd test for issue #4253cue/load,internal/mod/modpkgloadrespect nested cue.mod boundariescue/inject/embedresolve files via cue/load.Config's FS or Overlaycueadd regression test for predeclared builtin shadowing in %vcue/ast/astutildetect aliasv2 postfix label-name redeclarationscue/ast/astutiladd test coverage for redeclared alias errorscueallow and enforce parens for single postfix aliascue/ast/astutil,tools/fixadd cross-file shadowing detection for predeclared identifierscue/format,fixhandle trailing commas in listscue/parserallow omitting commas in listscue/testdatare-test with CUE_UPDATE=1cue/loadsupport absolute directory paths as package argscue/astadd Interpolation.Quotes helpercueremove long-deprecated and hidden Instance methodscue/literalreject trailing characters after SI multipliercueuse %q rather than %s in fuzzing errorscue/literalreject NUL bytes in ParseNumcue/scanneraccept SI multiplier after a bare 0cue/scanneralign raw quote lexing with cue/literalcue/cuecontextallow multiple injections for a given kindcue/scannerfix greedy lexing of _ followed by |cue/testdataconvert txtar tests to inline @test formatcue/testdataadd @test to cycle/issue3527cue/testdatarename #todo:inline: markerscue/astremove the deprecated File.Imports slicecue/testdata/benchmarksconvert to inline @test formatcue/testdata/cycleharder casescue/testdataconversion of cases marked as "hard"cue/testdatamore issue descriptions and linkscue/testdataadd shareID annotations and fix pos= line numberscue/testdata/comprehensionsmanual correctionscue/testdata/evalmanual correctionscue/testdata/resolvemanual correctionscue/testdataconvert remaining medium testscue/testdataconvert disjunctions tests to inline @test formatcue/testdataconvert comprehensions tests to @test formatcue/testdataconvert eval/ tests to @test formatcue/testdataforce update cleanupcue/testdataconvert resolve/ tests to inline @test formatcue/testdataconvert definitions/ tests to inline @test formatcue/testdataconvert definitions/ and comprehensions/ testscue/testdataconvert choosedefault/ compile tests to use @testcue/testdataconvert builtins tests to inline @test formatcue/testdataadd missing issue comments to txtar filescue/testdataadd issue comments to txtar test filescue/testdataconvert comparison, interpolation, list, and scalar tests to inline formatcue/literalreject triple quotes at line start in multiline stringscue/testdata/fuzzremove a file I added by accidentcueexempt preamble keywords from fuzzer's ParseFile vs ParseExpr checkcue/build, cue/loadadd ModuleVersion field to build.Instancecue/literalreject invalid UTF-8 in Unquotecue/scannerreject leading-zero integers followed by range operatorcue/parseruse named error return in ParseExpr to fix error loss on bail-outcuealways check that ParseExpr doesn't panic in the fuzzercue/literalreject literal NUL bytes in Unquotecueadd Attribute.Args iteratorcuerefactor attribute testcue/literalfix panic when parsing an empty stringcue/parserinitialize experiments in ParseExprcue/literalreject invalid characters after digits in ParseNumcue/scannerdon't let bare \r prevent multiline string closingcue/scannerrefactor TestScan to use named fields and a want fieldcue/testdataadd issue headers and convert tests to inline formatcue/literalreject consecutive underscores in numbers like the parser doescue/literalreject leading-zero integers like the parser doescuefuzz invalid CUE source as wellcue/scannerreject multiline strings with non-matching whitespacecueadd more entries to the fuzzing seed corpuscue/literalallow triple quotes inside multiline string contentcue/scannerexpand checkError to scan past interpolations toocue/testdatare-test with CUE_UPDATE=1cue/testdataconvert txtar tests to inline @test formatcue/testdata/evalconvert eval txtar tests to inline @test formatcue/testdataconvert easy inline testscue/testdataconvert issue2649 to inlinecue/testdatamark unconverted testscue/testdataconvert list/comprehension testscue/testdata/basicrewriteconvert basiccue/testdataconvert fulleval/resolvecue/testdataconvert tests to inline @test annotationscue/scannerreject underscores in string escape sequencescue/scannerreject octal and hex escapes in string literalscue/literalallow bare carriage return in single-line stringscue/scannerreject exponents with no digitscueteach the fuzzer to check against cue/ast and cue/literalcue/scannerreject closing quotes of multiline strings not after a newlinecue/scannerreject __# as an invalid identifiercueteach the fuzzer to cover cue/format, ast.Walk, and astutil.Applycuemove fuzz_test.go from cue/parser and expand a bitcue/testdataadd regression test for issue #1886cue/testdataadd a regression test for issue #2405cue/testdataadd regression test for issue #962cue/loadfs.FS supportcueclarify that values no longer need to come from the same contextcue/formatfix indentation of multiline strings with interpolationcue/formatchange default tab width from 8 to 4cue/formatadd a test showing how each Option behavescue/formatfix spurious empty line between definitionscueallow concurrent use of Valuecue/formatfix incorrect column alignment in lists and call argscue/formatadd test cases for issue #1006cue/literalmake invalid multi-line string whitespace errors explicitcue/formatfix field alignment for manual ASTs with relative positionscue/formatadd regression test for #4296cue/formatclarify the default behavior for the spacing optionscueimprove error messages for hidden fields in pathscue/errorsuse token.Pos.Compare in Positionscueadd tests showing how ast.NewPredeclared fails to compilecuefix Value.ReferencePath on top level valuecueadd test case for Value.ReferencePath at top level
doc7
doc/reftreat "$" as a valid identifier in the specdoc/refclarify the rule for preceding whitespace in multiline stringsdoc/ref/spec.mdshow multiple package attributes in exampledoc/refstart testing code blocks which we expect to fail parsingdoc/refstart testing CUE code blocks in the spec viago testdoc/refannotate CUE code blocks via their triple backticksdoc/refannotate EBNF code blocks via their triple backticks
encoding7
encoding/iniintroduce an INI decoderencoding/jsonschemasupportdescriptionkeywordencoding/jsonclarify and test the behavior of nil data with Extractencodingadd godoc hints for cue/ast result typesencoding/jsonschemarecognize builtin validators without callencoding/jsonschemahandle items keyword correctly in draft2020-12encoding/jsonschemafix two bugs in CUE-to-JSON-Schema generation
internal134
internal/cibump Go and goreleaser versions for v0.17.0-alpha.1internal/core/exportsanitize Profile.Value outputinternal/core/exportmark predeclared builtin references as suchinternal/core/exportadd test for predeclared builtin shadowinginternal/core/adtfix conjunction semantics for opened embeddingsinternal/core__reclose: detect and restore non-recursive closinginternal/core/adtdocument why toComplete hook must stayinternal/core/adtremove completeNodeTasks from doDisjunctinternal/core/adtstrengthen field-set and arc-type checksinternal/core/adtremove dead code in process and evalStateCIinternal/core/adtfix error propagation bug in inline structsinternal/core/adtremove support for list task dependenciesinternal/core/adtremove taskPos field from schedulerinternal/core/adtadd handleParents and processAncestorsinternal/core/adtstreamline task equality checkinginternal/core/adtget rid of schedFINALIZINGinternal/cueexperimentadd ShortCircuit experimentinternal/lspadd toggle surrounding struct braces code actioninternal/core/adtunify builtin-range matching under MatchBuiltinRangeinternal/corerender predeclared ranged numeric types by nameinternal/core/debugdocument Config fieldsinternal/cuetxtarremove @test(leq)internal/cuetxtarfix two inline runner bugsinternal/cuetxtaradd field coverage checkinginternal/cuetxtaruse structural_cycle codeinternal/cuetxtarauto-manage out/errors.txtinternal/cuetxtarmerge permuteCount into permute directiveinternal/cuetxtarsimplify empty @test()internal/core/exportfix infinite recursion in vertex() on cyclic BuiltinValidatorinternal/cuetxtarconvert runner tests to txtar inline formatinternal/cuetxtarhandle field aliases in labelSelectorinternal/cuetxtaremit embedded scalarsinternal/cuetxtarinclude definitions in list elements of @test(eq)internal/cuetxtarenhance @test(err) fillinternal/cuetxtarfix two @test(err) bugs and unify validation logicinternal/cuetxtaremit @test(err,...) annotation for error fields in eq fillinternal/cuetxtaradd txtar testinternal/cuetxtarfill nested pos=[]internal/cuetxtarfix deduplication for at= directivesinternal/cuetxtarextend shareID checks and fix path aliasinginternal/cuetxtarimprove eq value formatterinternal/cuetxtarsplit inline.gointernal/cuetxtardetect misplaced @testinternal/cuetxtaradd custom eq formatter for hidden fields and disjunctionsinternal/cuetxtarfix hidden-field path handling in source AST walkerinternal/cuetxtarrestrict @test(allows) to struct/listinternal/cuetxtarimprove @test(eq) formatting and body validationinternal/cuetxtarfix error message formattinginternal/cuetxtaradd @test(allows, sel) directiveinternal/cuetxtaromit optional error fields in closed structsinternal/cuetxtarfix shared disjunction eq; add at= supportinternal/cuetxtarunify write-backs; strip test attrs from formatted valuesinternal/cuetxtarfix error positions to reference original sourceinternal/cuetxtarrename debugOutput to debuginternal/cuetxtarfix debug attr formattinginternal/cuetxtardetect hidden/def fields in non-struct @test(eq)internal/core/runtimerename Interpreter/Compiler to Injection/Injectorinternal/lspimplement organise imports code actioninternalremove cuetest.Chunkerinternal/core/runtimerefactor ExtractAttrsByKindinternalreplace ParseAttrBody with ParseAttrinternal/core/exportfix hidden field visibility for anonymous pkgIDinternal/core/pathremove unused internal packageinternal/copyremove unused internal packageinternal/cuetxtarfix astcmp for embedded scalarsinternal/cuetxtarfix error message formattinginternal/cuetxtarfix permuteCount lookup and log permutation countinternal/cuetxtarerror on suberr without =internal/core/adtstop comparing V3/V2 stats in TestEvalV3internal/cuetxtarfix CUE_UPDATE=force for eqinternal/cuetxtarreport @test parse errorsinternal/cuetxtaradd err:todo, incorrect, and p= modifiersinternal/cuetxtarfix pattern label comparison in @test(eq, ...)internal/golangorgxdelete Go-specific analyzer infrastructureinternal/golangorgxdelete unused gopls protocol/command packageinternal/lspsupport lazy code action edit resolutioninternal/cuetxtaradd hint= flag and unknown-flag validation to @test directivesinternal/cuetxtarfix @test(debugOutput) multiline string formatinternal/cuetxtarsimplify regression guard for @test(eq) mismatchesinternal/cuetxtarrequire commas between pos= specsinternal/cuetxtaradd at=, pos= order-independence, and hidden field guardsinternal/cuetxtaradd args= and suberr= to @test(err, ...)internal/cuetxtarsupport suberr=(...) in @test(err, ...)internal/cuetxtarmove error assertion code to inline_err.gointernal/cuetxtarsupport shareID assertions in inline testsinternal/cuetxtardocument new @test directivesinternal/cuetxtarshow ./ prefix in out/errors.txt pathsinternal/cuetxtarfix inline loaderinternal/cuetxtarsupport struct-embed form in @test(eq, ...)internal/cuetxtardetect @test in comprehensionsinternal/cuetxtarsupport multi-code errorsinternal/cuetxtaradd out/errors.txt sectioninternal/cuetxtaradd validator and todo supportinternal/cuetxtaradd inline test runnerinternal/lspdebounce sending non-empty diagnosticsinternal/pkgrely on the adt package to wrap call errorsinternal/core/adtimplement BuiltinValidator equalityinternal/core/convertavoid allocating when checking for omitemptyinternal/core/adtuse grouped allocation for let Vertex and Conjunctinternal/pkgremove unnecessary runtime fieldsinternal/core/adtuse strings.Builder for interpolationsinternal/core/compilereturn Disjunction directly from or() builtininternal/core/adtfix !=null as top-level embedding losing constraintinternal/core/adtadd test for !=null as top-level embeddinginternal/core/adtallocate tasks in chunks to reduce GC overheadinternal/core/adtavoid interface boxing in error creationinternal/lspcorrect attributes in expressionsinternal/core/adtuse inline buffer for error position slicesinternal/core/adtuse slices.Clip instead of slices.Clone for Conjunctsinternal/core/adtpropagate ClosedNonRecursive for non-data verticesinternal/core/adtfix closedness check for cross-package embedded disjunctionsinternal/core/runtimerename "test" extern interpreter to "testfn"internal/diffuse Myers algorithm for listsinternal/diffmemoize shared-vertex pairs to avoid re-traversalinternal/core/exportadd regression test for issue 3714internal/lsp/fscacheuse internal.Package helperinternal/lspadd support for evaluation via external validatorsinternal/cueversionbump for the upcoming v0.17 release cycleinternal/core/convertsimplify typeAssertinternal/core/convertfix astFromGoType for recursive types and shared AST pointersinternal/core/compileavoid mutating ASTinternal/core/convertsplit FromGoType into AST and ADT phasesinternal/core/exportfix alias/field name conflict in pattern constraintsinternal/core/exportadd regression test for alias/field name conflictinternal/encoding/gotypespreserve type references through conjunctionsinternal/core/convertfix panic when encoding pointer-receiver marshalersinternal/cidefault to a later version of the CI commit checksinternal/core/compilerecognize ast.NewPredeclaredinternal/core/adtalways add disjunctionTask on builtin arg evalinternal/core/adtdo not side-effect argument state to result stateinternal/ciuse OIDC with the Central Registry for the e2e testsinternalbump staticcheck to v0.7.0 for Go 1.26 supportinternal/core/adtpreparatory work for user-defined functionsinternal/core/adtremove CallContext.Args method
lsp13
lsp/evalcorrect lsp evaluator for importslsp/evalteach lsp to understand "close"lsp/evaladd tests showing current behaviour for close callslsp/evaltreat disjunctions the same as conjunctionslsp/evaladd support for aliasv2 experimentlsp/evalrework field name(s) analysislsp/extvalidatorsupport https://github.com/ remoteslsp/serverremove mutexlsp/cacheimprove renamelsp/serverprotect lsp state modifications with mutexlsp/evalcorrect resolution of package-level fieldslsp/evaladd test showing bad behaviourlsp/servermake "Remove surrounding struct braces" preferred
mod4
mod/modregistrytestadd metadata capabilitymod/modconfigset DOCKER_CONFIG in tests to prevent hangsmod/module,cue/load,internal/filetypesreject version in import qualifiermod/modfile,internal/modclean up now that #2733 is fixed
pkg8
pkg/tool/httprestore Do request header/trailer to accept single stringspkg/network around upstream idna bug breaking net.FQDN validationpkg/netadd regression tests for net.FQDN with invalid domain namespkg/listimprove error message for MatchNpkg/strconvallow string argument for FormatFloat format parameterpkg/netreturn errors for unexpected types in IP validatorspkg/netadd regression tests for IP validators with unexpected typespkgfix godoc mistakes across several packages
tools3
tools/fixextract and extend explicitopen fixtools/fixadd inline @test frameworktools/jsonrpc2permit func enqueuing into message daisychain
Other15
- update dependencies ahead of v0.17.0-alpha.1
.clauderemove deny clause.gitignoreignore .gocache- Revert "internal/core/adt: remove now-unnecessary panic workaround"
CLAUDE.mduse cueckoo guidance as a baselistsuggest MatchN for non-concrete values in Contains doc- update the rest of the direct dependencies
- update all golang.org/x/... dependencies
protobuf/jsonpbfix panic when decoding non-string bytes- remove f.txtar and gitignore any such files going forward
- simplify and generalize
@externsupport gopls/cmdremove unused codeintegration/workspaceadd test showing bad behaviourREADMEclarify that source archive builds lack version info- re-enable staticcheck's SA4000 and SA4003 checks
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_9bf503ff67cba7e4c69ad2e5dd916da64e1fa5d2b28dd9165800919e898e1281 |
| macOS, Apple silicon | cue_1f2fe793ecfbecf32274eb9e0129686ba1239366193935cd796b79ff6d8c6ca6 |
| Linux, x86-64 | cue_7f9c1b8552b9c3888528be231de7c781b184c5f6a24dc242ddd8c02bcdac0cf4 |
| Linux, Arm64 | cue_6c24ed59dd82a782b064f2bb35c113745f926f60e88c991d88fc555ae8d2ec1c |
| Windows, x86-64 | cue_8164f4019fdc875c734a0c4c44716708633c27fba767c663d23a3320720efd66 |
| Windows, Arm64 | cue_fa8f0ae79515d7b025a873cd9f060224295c12e577c16badf9bfb6f8707f1f06 |