package cueexperiment
import "cuelang.org/go/internal/cueexperiment"
Index ¶
Functions ¶
func Init ¶
func Init() error
Init initializes Flags. Note: this isn't named "init" because we don't always want it to be called (for example we don't want it to be called when running "cue help"), and also because we want the failure mode to be one of error not panic, which would be the only option if it was a top level init function.
Types ¶
type Config ¶
type Config struct { // EvalV3 enables the new CUE evaluator, addressing performance issues // and bringing better algorithms for disjunctions, closedness, and cycles. // // This experiment was introduced in v0.9.0 (2024-06), // and enabled by default in v0.13.0 (2025-05). EvalV3 bool `envflag:"default:true"` // CmdReferencePkg requires referencing an imported tool package to declare tasks. // Otherwise, declaring tasks via "$id" or "kind" string fields is allowed. // // This experiment was introduced in v0.13.0 (2025-05), // and enabled by default in the upcoming v0.14 release. CmdReferencePkg bool `envflag:"default:true"` // KeepValidators prevents validators from simplifying into concrete values, // even if their concrete value could be derived, such as `>=1 & <=1` to `1`. // See the proposal at https://cuelang.org/discussion/3775. // // This experiment is introduced in the upcoming v0.14 release, already on by default. KeepValidators bool `envflag:"default:true"` // Modules enables support for the modules and package management proposal // as described in https://cuelang.org/discussion/2939. // // This experiment was introduced in v0.8.0 (2024-03), // enabled by default in v0.9.0 (2024-06), // and deprecated in v0.11.0 (2024-11). Modules bool `envflag:"deprecated,default:true"` // YAMLV3Decoder swaps the old internal/third_party/yaml decoder with the new // decoder implemented in internal/encoding/yaml on top of yaml.v3. // // This experiment was introduced in v0.9.0 (2024-06), already on by default, // and was deprecated in v0.11.0 (2024-11). YAMLV3Decoder bool `envflag:"deprecated,default:true"` // DecodeInt64 changes [cuelang.org/go/cue.Value.Decode] to choose // `int64` rather than `int` as the default type for CUE integer values // to ensure consistency with 32-bit platforms. // // This experiment was introduced in v0.11.0 (2024-11), // enabled by default in v0.12.0 (2025-01), // and was deprecated in v0.13.0 (2025-05). DecodeInt64 bool `envflag:"deprecated,default:true"` // Embed enables support for embedded data files as described in // https://cuelang.org/discussion/3264. // // This experiment was introduced in v0.10.0 (2024-08), // enabled by default in v0.12.0 (2025-01), // and deprecated in the upcoming v0.14 release. Embed bool `envflag:"deprecated,default:true"` // TopoSort enables topological sorting of struct fields. // Provide feedback via https://cuelang.org/issue/3558. // // This experiment was introduced in v0.11.0 (2024-11) // enabled by default in v0.12.0 (2025-01), // and deprecated in the upcoming v0.14 release. TopoSort bool `envflag:"deprecated,default:true"` }
Config holds the set of known CUE_EXPERIMENT flags.
When adding, deleting, or modifying entries below, update cmd/cue/cmd/help.go as well for `cue help environment`.
var Flags Config
Flags holds the set of global CUE_EXPERIMENT flags. It is initialized by Init.
type File ¶
type File struct { // Testing is used to enable experiments for testing. // // TODO: we could later use it for enabling testing features, such as // testing-specific builtins. Testing bool `experiment:"since:v0.13.0"` // StructCmp enables comparison of structs. This also defines the == // operator to be defined on all values. For instance, comparing `1` and // "foo" will return false, whereas previously it would return an error. // // Proposal was defined in https://cuelang.org/issue/2358. StructCmp bool `experiment:"since:v0.14.0"` // contains filtered or unexported fields }
File defines the experiments that can be set per file. Users can activate experiments by setting them using a file-based attribute @experiment() in a CUE file. When an experiment is first introduced, it is disabled by default.
since: the version from when the experiment was introduced. accepted: the version from when it is permanently set to true. rejected: results in an error if the user attempts to use the flag.
func NewFile ¶
NewFile parses the given comma-separated list of experiments for the given version and returns a PerFile struct with the experiments enabled. A empty version indicates the default version.
func (*File) LanguageVersion ¶
LanguageVersion returns the language version of the file or "" if no language version is associated with it.
Source Files ¶
exp.go file.go parse.go
- Version
- v0.14.0 (latest)
- Published
- Aug 1, 2025
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 1 day ago –
Tools for package owners.