v0.16.0-alpha.1
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 cmdreferencepkg global experiment is now stable, meaning that CUE_EXPERIMENT=cmdreferencepkg is always enabled.
#"""# is now accepted as a string literal quoting a double quote, ".
Multiline string literals now require a trailing newline, matching the language spec.
Evaluator
Performance
Further improve the use of caching in the typochecker algorithm; this provides speed-ups of up to 80% on some large projects.
Very large structs (tested with 20,000 fields) are up to 80% faster now, as we were repeating some work unnecessarily.
A great deal of effort has gone into reducing the allocations and memory usage across a number of projects. For some of these, memory usage is down by as much as 60%.
These improvements were possible thanks to our Unity service, letting us analyze CUE’s performance and test for regressions on third party projects. Contact @mvdan on Discord, Slack, or via the Unity page to ensure that your project is included or you are running into slowness.
Other changes
Fix a regression introduced in v0.13 where the or built-in with literal arguments could stop behaving like a disjunction.
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
Add support for $DOCKER_AUTH_CONFIG to directly provide the contents of $DOCKER_CONFIG/config.json to authenticate with module registries, matching Docker’s current behavior.
The --outfile flag now works when given non-regular files such as named pipes or sockets.
⚠️ cue mod publish no longer ignores sub-directories containing a go.mod file as if they were nested CUE modules; those are already skipped based on the presence of cue.mod.
⚠️ Using cue inside the cue.mod directory now fails consistently with a clear error message to not place CUE code there. Previously, some commands worked while others failed with confusing errors.
LSP server
Completions: a complete overhaul of how the LSP server suggests code completions. This solves the previous naïve implementation which would only make suggestions after a field name or path had been started. Now completions are available from within whitespace.
Embedded paths with mutual dependencies: embedded paths with multiple components (e.g. a.b.c) can in some cases only be fully resolved after the resolution of other embedded paths. The LSP server can now correctly handle these dependencies.
Document Symbols: the CUE LSP server now implements LSP “Document Symbols” functionality. This is often used by editors to provide light-weight breadcrumb navigation within a file.
Diagnostics: some preliminary diagnostics are now sent from the LSP server back to the editor. Initially this mainly indicates syntax errors in CUE files, but this can be extended in the future.
Bug fixes: many smaller bug fixes, addressing issues around imports, path resolution, formatting of standalone CUE files, amongst others.
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
cue get go now detects which Go packages use Kubernetes type semantics via // +k8s:openapi-gen=true and obeys the field annotations // +optional and // +nullable.
cue get go gains a --codec flag to configure the use and priority of Go struct field tags like json or yaml.
Fix a bug where cue get go could skip over fields whose type implements one of the supported marshaling interfaces.
Fix a few bugs where cue get go could result in invalid or failing CUE code.
JSON Schema’s Config.OpenOnlyWhenExplicit option is now exposed for the CLI via the filetype tag jsonschema+openOnlyWhenExplicit.
JSON Schema now properly encodes hash references for better compatibility with other tools.
Standard library
The strconv package adds ParseNumber, like ParseInt or ParseFloat but allowing other CUE number strings such as 1Ki.
The net package adds InCIDR to test whether an IP is contained by a CIDR string.
The net package adds ParseCIDR to extract useful information from a CIDR string.
Go API
cue.Value.Decode now supports the new cue.Unmarshaler interface, allowing Go types to implement their own CUE value decoding logic via an UnmarshalCUE(cue.Value) error method.
The new cue.IsIncomplete function reports whether the given value is a CUE incomplete error.
⚠️ cue.Value.Decode now uses cue.IsIncomplete to not treat incomplete errors as fatal, allowing the decoding to continue.
Fix a bug where cue.Value.Decode could behave incorrectly when decoding a CUE null or incomplete value.
⚠️ The long-deprecated cue/ast.Node.Comments and cue/ast.Node.AddComment interface methods are now removed; use cue/ast.Comments and cue/ast.AddComment respectively.
⚠️ The long-deprecated and unused cue/parser.FromVersion and cue/parser.DeprecationError APIs are now removed.
All changes
254 changes since v0.15.0by area
.claude3
.claudeallow more commands.claudeexpand the list of allowed commands.claudeallowgit grep
all8
allstart using slices.DeleteFuncallfix up uses of the deprecated cue.Value.Elem methodallfix up uses of the deprecated cue/ast comment methodsallreplace cue.Value.Null with IsNull when we just need a boolalluse cue/token.Pos.IsValid rather than comparing with NoPosallmake use of adt.Pos consistentlyallgo fix -stringsbuilder ./...allgo fix -forvar ./...
cmd42
cmd/cueadd a testscript running commands inside cue.modcmd/cueclarify the restrictions around @embed file pathscmd/cueappease gopls in gen_experiments_help.gocmd/cuerelax login --token prefix validationcmd/cueallow non-regular files with --outfilecmd/cuecorrectly parse type=number and type=int tagscmd/cueadd a test for a type=number injection tagcmd/cueadd test cases forcue cmdtag injection with more typescmd/cuereintroducetype: "file"default inexp writefscmd/cuesimplifyexp writefsexample a bitcmd/cuerewriteexp writefsto not requirego runcmd/cueaddexp writefsmoving the code from the cuelang.org repocmd/cueavoid panic inget gowhen an enum has zero named valuescmd/cueget go: expose field name lookup prioritycmd/cuetest --outfile and --force with named pipescmd/cueadd support for DOCKER_AUTH_CONFIG OCI registry credentialscmd/cueremove all "not yet stable"cue modnotescmd/cuequote Go field tags if they are invalid CUE attribute bodiescmd/cuetest howcue get gogenerates invalid CUE attributescmd/cuestabilize mod registry, rename, mirrorcmd/cueensure thatcue get goresults in valid CUEcmd/cueGo types implementing a supported interface are themselves supportedcmd/cueadd test case for issue #2633cmd/cuefix regression with unsupported named typescmd/cueskip over type aliases more preciselycmd/cueminorget gocleanupscmd/cueremove types.Invalid checkscmd/cuefix non-null map values being detected as nullablecmd/cuedetect kubernetes semantics forget gocmd/cueadd kubernetes semantics testcmd/cuedo not emit empty CUE files inget goagaincmd/cuetest that we don't emit empty CUE files without --outfilecmd/cuestabilize CUE_EXPERIMENT=cmdreferencepkgcmd/cuerewrite tool/http test to not rely on an internal httptest servercmd/cueclarify help wording about filenames containing colonscmd/cuetry to deflake stats test on CIcmd/cueadd smoke tests for CUE_STATS_FILE and CUE_BENCHcmd/cuereuse fetchStats for CUE_BENCHcmd/cueinclude syscall.Rusage stats in CUE_STATScmd/cuemove fetching of Stats numbers into a separate funccmd/cueremove the deprecated --strict flagcmd/cuego fix -stditerators ./...
cue45
cue/loaderror when loading packages from inside cue.modcue/formatsimplify label replacement without astutil.Applycue/formatfix comma placement for ellipsis with inline commentscue/formatadd test for issue #4238cueadd IsIncomplete for checking for incomplete errorscueadd test case for decoding incomplete valuecue/testdata/cycleadd test for issue #4230cue/tokenPos.Add should be noop if Pos is not absolutecue/ast/astutilfix nil pointer dereference in postfix alias errorcuesimplify unmarshaler logic further a bitcuerefactor how Decode handles custom unmarshalerscue/parseradd test cases for newlines in interpolationscue/astAdd period position to selectorcue/formatfix single import with trailing commentcuesupport custom CUE unmarshalling via Unmarshalercue/loadonly inject a tag value when it was parsed correctlycue/parsersimplify how we deal with the ancient alias syntaxcue/parsersimplify parseComprehensionClausescue/parsersignal missing tokens via token.NoPoscue/parseruse errorExpected more consistentlycue/parserbalance newlines on multiline composite literalscue/parserreuse Parser.expect for more tokenscue/parsersimplify the expectComma logiccue/literalrequire multiline literals to end with a newlinecue/literaladd test cases for multiline literals with missing newlinescue/testdatastart a disjunctions/discriminator.txtar filecue/testdataadd regression test for issue #2685cue/testdataadd a regression test for issue #3842cue/astadd walkNilable and applyNilable helperscue/cuecontextwrite a short package godoccue/ast,mod/modfileadd two morego:fix inlinedirectivescue/parserdelay ast.Field allocation in parseFieldcueindirect the Go value before checking for null or noncretecueadd more test cases to TestDecodecue/astremove Node.Comments and Node.AddCommentcue/literalaccept #"""# as a quoted double quotecue/astcorrect valid values for BasicLit.Kindcue/astCorrect Interpolation.End()cue/testdataadd test case for #3719cue/testdataadd a test case for #4180cueconvert.GoValueToValue returns a finalized valuecue/parserremove deprecated integer version APIscueadd happy paths to Value.getNum and Value.Stringcue/astremove deprecated and unhelpful Field node fieldscueremove the two last evalv2 remnants
encoding4
encoding/jsoncorrect positions of field labels from jsonencoding/jsonschemacorrectly encode referencesencoding/tomlcorrectly check for duplicate keys with arraysencoding/tomlforget nested arrays when starting a new array element
internal126
internal/core/adtfix spurious error in ForClause.yield key bindinginternal/cueexperimentclarify the docs and update the orderinginternal/cibump Go and goreleaser for v0.16.0-alpha.1internal/core/adtavoid allocations in matchPatterninternal/core/adtremove redundant updateConjunctInfo callinternal/core/convertallocate vertices in ensureArcVertex betterinternal/core/convertreuse singleton struct and list marker allocsinternal/core/adtremove unused parameters in Vertex.AddStructinternal/core/convertavoid repeated OpContext.Env callsinternal/core/convertavoid an allocation for "small" big.Int valuesinternal/core/adtalso use strings.ToValidUTF8 over x/text/encoding/unicodeinternal/core/convertuse strings.ToValidUTF8 over x/text/encoding/unicodeinternal/pkgavoid repeating the args adt.Value slice in CallCtxtinternal/core/adtplace CallContext on the stackinternal/core/convertavoid reflect.Value.Seq2 on maps toointernal/core/adtdo not allocate a new YieldFunc in processComprehensioninternal/core/adtpreallocate CallExpr.evaluate argsinternal/core/adtremove last comments about the evalv3 transitioninternal/core/adtfix regression in cycle handling for literal-only callsinternal/core/adtgroup allocations in ForClause.yieldinternal/core/debugfix stack overflow in error formattinginternal/lspsort results of find-definitions and find-referencesinternal/lspoverhaul the LSP evaluatorinternal/lsprename definitions to evalinternal/core/adtremove redundant position code after SimplifyBoundsinternal/core/adtsimplify disjunctErrorinternal/core/adtremove unused reportFieldMismatch parameterinternal/core/adtfix nil pointer dereference in BinaryExpr.evaluateinternal/ci/baseadd a #writefs CUE schemainternal/cibump Go and goreleaser versionsinternal/core/adtuse the pre-validation value kind to report errorsinternal/core/adtremove commented-out error assignment with a TODOinternal/core/adtremove the docs for evalv2's cycle detection algorithminternal/core/adtremove unnecessary isShared assignmentinternal/core/adtremove another unused branch with a TODOinternal/core/adtremove unused branch with TODOsinternal/core/adtremove branch with TODO which never triggersinternal/core/adtremove now-unnecessary panic workaroundinternal/core/adtshrink CloseInfo fields in nodeContextStateinternal/core/adtshrink scheduler by 40 bytesinternal/core/adtsimplify aStruct fieldinternal/core/adteagerly update kind to StructKind when aStruct is setinternal/core/adtdo not reuse large vertexMap mapsinternal/core/adtreuse vertex maps in overlayContextinternal/ciremove commit @-mention checkinternal/core/adtfix typointernal/core/adttreat a call on a non-concrete func as incompleteinternal/filetypessupport openOnlyWhenExplicit taginternal/core/adtjoin overlayContext's vertices with vertexMapinternal/core/toposortavoid repeating structInfos in nodeToStructMetasinternal/core/toposortavoid repeated ast.Node.Pos callsinternalremove unnecessary Pos methodsinternal/corevarious minor cleanupsinternal/core/adtremove Env and CloseInfo from StructInfointernal/core/adtdeduplicate Vertex.Structs by StructLitinternal/core/adtapply TODO to remove getArc call from addConstraintinternal/core/adtintroduce ConflictErrorinternal/core/convertreuse unicode.UTF8.NewEncoderinternal/core/adtcheck opID before inheriting parent reqSetsinternal/core/adtavoid allocations in Vertex.Default for closed listsinternal/core/adttrack containment positions separatelyinternal/core/adtreuse task objects within an OpContextinternal/core/adtallocate Vertex with space for one conjunct in getArcinternal/core/adtsimplify nodeContext.arcMapinternal/core/adtstore token.Pos rather than Node in containmentinternal/core/adtavoid adding replacements with replaceID.from == 0internal/core/adtimplement CycleInfo.IsCyclic TODOinternal/cmd/cue-ast,internal/astinternalsupport printing positionsinternal/core/adtsimplify func declarations now that evalv2 is goneinternal/core/adtadd reqSets.elemPtrsinternal/core/adtuse append-like func signatures for reqSetsinternal/core/adtgrow reqSets ahead of time in getReqSetsinternal/sourcereturn a size when Open is given an os.File as srcinternal/encodingdo not grow byte slices when reading source filesinternal/sourcedo not guarantee io.Closer in Openinternal/core/convertdo not create new cue/ast source nodesinternal/valueredesign Interface to avoid allocationsinternal/core/convertavoid reflect.Value.Seq2 for slicesinternal/core/convertgrow slices for Go structs and slicesinternal/core/adtgrow Vertex.Arcs in scheduleStructinternal/core/adtgrow Vertex.Arcs in processListLitinternal/core/convertavoid making unnecessary vertex copiesinternal/core/toposortmake Node.sccNodeState a non-pointerinternal/core/adtreduce allocations further in SimplifyBoundsinternal/core/adtSimplifyBounds can return nilinternal/core/toposortreturn a slice of non-pointers in analyseStructsinternal/core/toposortremove Node.Incominginternal/core/convertrefactor fromGoValue to only use reflect.Valueinternal/core/compiledon't panic on an alias cycle with a dynamic fieldinternal/core/adtreuse a buffer when constructing envDisjunct.disjunctsinternal/core/adtsimplify filterSets and filterTop a bitinternal/core/adtuse an uint64 key in containsDefIDCacheinternal/core/adtoptimize containsDefIDRec with minimum replaceID trackinginternal/core/compilerevertandto use Func instead of RawFuncinternal/core/subsumefix duplicate logic for pattern constraintsinternal/core/subsumeadd test cases for pattern constraintsinternal/filetypesuse a less generic bootstrap build taginternal/lspimplement support for LSP Diagnosticsinternal/lspimplement support for LSP DocumentSymbolsinternal/core/convertremove goConverterinternal/core/convertstop setting positions in cue/ast nodesinternal/core/exportadd a test to ensure toposort keeps Go field orderinternal/core/adtcheck removed scope per conjunctinternal/core/convertsimplify the top-level FromGoType logicinternal/core/convertreduce from 3 func APIs to 2internal/core/convertstop accepting reflect.Value as a Go valueinternal/pkgadd a happy path to CallCtxt.BigIntinternal/core/adtremove support for CUE_EXPERIMENT=keepvalidators=0internal/filetypessupport absolute paths with colons on Unixinternal/filetypesadd test cases for absolute paths with colonsinternal/lspformat standalone files without phantom pkg namesinternal/core/adtreduce slice allocations in nodeContext.getValidatorsinternal/pkgadd happy path shortcuts for CallCtxt argument gettersinternal/core/adtreuse more Bool allocationsinternal/core/convertdon't allocate when checking for types.Interfaceinternal/core/adtreduce allocs on BinOp for boolean operatorsinternal/filetypesmake ParseArgs more consistent with ParseFileinternal/filetypesclarify empty scope error in ParseFileinternal/filetypessupport Windows absolute paths in ParseFileinternal/filetypestest an empty scope and filename consistentlyinternal/filetypesadd test cases exposing issue 4168internal/cueversionbump LanguageVersion to v0.16.0internal/core/adtonly do a containsDefIDCache map lookup if cachinginternal/core/adtsort replaceIDs to scan just once in containsDefIDRecinternal/core/adtrefactor overlayContext.derefDisjunctsEnv awayinternal/core/adtcache containsDefID results in OpContext
lsp12
lsp/evalrework transitioning through importslsp/evalPath resolution must force eval of import specslsp/evalCorrect usages for import specslsp/evalcorrect evaluation of embedded litslsp/evaladd test showing bad behaviourlsp/definitionscorrect evaluation of import statementslsp/definitionsadd test showing bad behaviour for import statementslsp/definitionsimprove UsagesForOffset for importslsp/fscacheimprove removal of phantom package declslsp/definitionscorrect resolution of path rootslsp/definitionsadd test to show faulty resolutionlsp/cachestop nested modules from breaking find-references
mod3
mod/modzipcheck for cue.mod existence, not just directoriesmod/modzipcheck for cue.mod directories instead of go.mod filesmod/modzipadd test for go.mod submodule detection
pkg5
pkg/netadd ParseCIDR to extract CIDR informationpkg/netadd InCIDR to check if an IP is within a CIDR rangepkg/math/bitsavoid an extra allocation per callpkg/strconvre-run CUE_UPDATE=1 go testpkg/strconvadd ParseNumber builtin
Other6
CLAUDEdiscourage "go build" and add a set of "must follow" rules- update dependencies ahead of v0.16.0-alpha.1
doc/refclarify the relationship between exported and hidden identifiersCONTRIBUTINGfix links and tweak the wordingtools/flowsupport task results when defined via definitions- update all dependencies
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_dffd15fb9cdce7345dd26e2e6d0c70be6af708069a0588f039fc6269f2db8543 |
| macOS, Apple silicon | cue_5777f93bee9e11e2d3899765da22ccf875dea2b5c02d2bc8a035e82c4c045a89 |
| Linux, x86-64 | cue_dff153162c9906e6803ba3d2590b8428e0f3fcce615dd29b4682054b5de7c939 |
| Linux, Arm64 | cue_a3c08498350b5097197c3385387c4ca119ee82838c603a0035bfd0ef436fa892 |
| Windows, x86-64 | cue_a6fe363f251105da03f345972d1b9c0a53dcac4faaf21c0d4b19aecc76ecb329 |
| Windows, Arm64 | cue_96af980fee5a4591c83db69254def323ad668b8092151cca0e4c3c05683364ac |