go

module
v0.12.0-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0

README

Go Reference Documentation Github platforms Docker Image

CUE - Configure, Unify, Execute

CUE makes it easy to validate data, write schemas, and ensure configurations align with policies.

CUE works with a wide range of tools and formats that you're already using such as Go, JSON, YAML, OpenAPI, and JSON Schema.

For more information and documentation, including tutorials and guides, see cuelang.org.

Download and Install

The full range of installation methods for the cue command are listed on the cuelang.org site, including the official container image suitable for use with Docker. Here are two common ways to install the command:

Release builds

Download the latest release from GitHub.

Install from Source

You need Go 1.22 or later to install CUE from source:

go install cuelang.org/go/cmd/cue@latest

You can also clone the repository and build it directly via go install ./cmd/cue. Note that local builds lack version information, so you should inject the version string when building a release, such as:

git switch -d v0.11.0
go install -ldflags='-X cuelang.org/go/cmd/cue/cmd.version=v0.11.0' ./cmd/cue
Learning CUE

The fastest way to learn the basics is to follow the tour on the website.

More documentation including various tutorials can be found on the website.

References
Go release support policy

As a general rule, we support the two most recent major releases of Go, matching Go's security policy. For example, if CUE v0.7.0 is released when Go's latest version is 1.21.5, v0.7.x including any following bugfix releases will require Go 1.20 or later.

Contributing

To contribute, please read the Contribution Guide.

Code of Conduct

Guidelines for participating in CUE community spaces and a reporting process for handling issues can be found in the Code of Conduct.

Contact


Unless otherwise noted, the CUE source files are distributed under the Apache 2.0 license found in the LICENSE file.

Directories

Path Synopsis
cmd
cue
cue
Package cue is the main API for CUE evaluation.
Package cue is the main API for CUE evaluation.
ast
Package ast declares the types used to represent syntax trees for CUE packages.
Package ast declares the types used to represent syntax trees for CUE packages.
build
Package build defines data types and utilities for defining CUE configuration instances.
Package build defines data types and utilities for defining CUE configuration instances.
errors
Package errors defines shared types for handling CUE errors.
Package errors defines shared types for handling CUE errors.
format
Package format implements standard formatting of CUE configurations.
Package format implements standard formatting of CUE configurations.
interpreter/embed
Package embed provides capabilities to CUE to embed any file that resides within a CUE module into CUE either verbatim or decoded.
Package embed provides capabilities to CUE to embed any file that resides within a CUE module into CUE either verbatim or decoded.
interpreter/wasm
Package wasm allows users to write their own functions and make them available to CUE via Wasm modules.
Package wasm allows users to write their own functions and make them available to CUE via Wasm modules.
literal
Package literal implements conversions to and from string representations of basic data types.
Package literal implements conversions to and from string representations of basic data types.
load
Package load loads CUE instances.
Package load loads CUE instances.
parser
Package parser implements a parser for CUE source files.
Package parser implements a parser for CUE source files.
scanner
Package scanner implements a scanner for CUE source text.
Package scanner implements a scanner for CUE source text.
stats
Package stats is an experimental package for getting statistics on CUE evaluations.
Package stats is an experimental package for getting statistics on CUE evaluations.
token
Package token defines constants representing the lexical tokens of the Go programming language and basic operations on tokens (printing, predicates).
Package token defines constants representing the lexical tokens of the Go programming language and basic operations on tokens (printing, predicates).
Package cuego allows using CUE constraints in Go programs.
Package cuego allows using CUE constraints in Go programs.
Package encoding contains subpackages to convert CUE to and from byte-level and textual representations.
Package encoding contains subpackages to convert CUE to and from byte-level and textual representations.
gocode
Package gocode defines functions for extracting CUE definitions from Go code and generating Go code from CUE values.
Package gocode defines functions for extracting CUE definitions from Go code and generating Go code from CUE values.
gocode/gocodec
Package gocodec converts Go to and from CUE and validates Go values based on CUE constraints.
Package gocodec converts Go to and from CUE and validates Go values based on CUE constraints.
json
Package json converts JSON to and from CUE.
Package json converts JSON to and from CUE.
jsonschema
Package jsonschema converts JSON Schema to CUE
Package jsonschema converts JSON Schema to CUE
openapi
Package openapi provides functionality for mapping CUE to and from OpenAPI v3.0.0.
Package openapi provides functionality for mapping CUE to and from OpenAPI v3.0.0.
protobuf
Package protobuf defines functionality for parsing protocol buffer definitions and instances.
Package protobuf defines functionality for parsing protocol buffer definitions and instances.
protobuf/jsonpb
Package jsonpb rewrites a CUE expression based upon the Protobuf interpretation of JSON.
Package jsonpb rewrites a CUE expression based upon the Protobuf interpretation of JSON.
protobuf/textproto
Package textproto converts text protobuffer files to and from CUE.
Package textproto converts text protobuffer files to and from CUE.
toml
Package toml converts TOML to and from CUE.
Package toml converts TOML to and from CUE.
yaml
Package yaml converts YAML encodings to and from CUE.
Package yaml converts YAML encodings to and from CUE.
Package internal exposes some cue internals to other packages.
Package internal exposes some cue internals to other packages.
buildattr
Package buildattr implements support for interpreting the @if build attributes in CUE files.
Package buildattr implements support for interpreting the @if build attributes in CUE files.
ci
cli
cmd/cue-ast
cue-ast-print parses a CUE file and prints its syntax tree, for example:
cue-ast-print parses a CUE file and prints its syntax tree, for example:
copy
Package copy provides utilities to copy files and directories.
Package copy provides utilities to copy files and directories.
core/adt
Package adt represents partially and fully evaluated CUE types.
Package adt represents partially and fully evaluated CUE types.
core/convert
Package convert allows converting to and from Go values and Types.
Package convert allows converting to and from Go values and Types.
core/debug
Package debug prints a given ADT node.
Package debug prints a given ADT node.
core/dep
Package dep analyzes dependencies between values.
Package dep analyzes dependencies between values.
core/path
Package path provides utilities for converting cue.Selectors and cue.Paths to internal equivalents.
Package path provides utilities for converting cue.Selectors and cue.Paths to internal equivalents.
core/subsume
Package subsume defines various subsumption relations.
Package subsume defines various subsumption relations.
core/validate
Package validate collects errors from an evaluated Vertex.
Package validate collects errors from an evaluated Vertex.
core/walk
walk provides functions for visiting the nodes of an ADT tree.
walk provides functions for visiting the nodes of an ADT tree.
cueconfig
Package cueconfig holds internal API relating to CUE configuration.
Package cueconfig holds internal API relating to CUE configuration.
cueimports
Package cueimports provides support for reading the import section of a CUE file without needing to read the rest of it.
Package cueimports provides support for reading the import section of a CUE file without needing to read the rest of it.
cuetdtest
Package testing is a helper package for test packages in the CUE project.
Package testing is a helper package for test packages in the CUE project.
cuetest
Package testing is a helper package for test packages in the CUE project.
Package testing is a helper package for test packages in the CUE project.
cueversion
Package cueversion provides access to the version of the cuelang.org/go module.
Package cueversion provides access to the version of the cuelang.org/go module.
golangorgx/gopls/cache
Package cache is the core of gopls: it is concerned with state management, dependency analysis, and invalidation; and it holds the machinery of type checking and modular static analysis.
Package cache is the core of gopls: it is concerned with state management, dependency analysis, and invalidation; and it holds the machinery of type checking and modular static analysis.
golangorgx/gopls/cache/metadata
The metadata package defines types and functions for working with package metadata, which describes Go packages and their relationships.
The metadata package defines types and functions for working with package metadata, which describes Go packages and their relationships.
golangorgx/gopls/cache/methodsets
Package methodsets defines an incremental, serializable index of method-set information that allows efficient 'implements' queries across packages of the workspace without using the type checker.
Package methodsets defines an incremental, serializable index of method-set information that allows efficient 'implements' queries across packages of the workspace without using the type checker.
golangorgx/gopls/cache/typerefs
Package typerefs extracts symbol-level reachability information from the syntax of a Go package.
Package typerefs extracts symbol-level reachability information from the syntax of a Go package.
golangorgx/gopls/cache/xrefs
Package xrefs defines the serializable index of cross-package references that is computed during type checking.
Package xrefs defines the serializable index of cross-package references that is computed during type checking.
golangorgx/gopls/cmd
Package cmd handles the gopls command line.
Package cmd handles the gopls command line.
golangorgx/gopls/cuelang
Package golang defines the LSP features for navigation, analysis, and refactoring of Go source code.
Package golang defines the LSP features for navigation, analysis, and refactoring of Go source code.
golangorgx/gopls/debug
Package debug exports debug information for gopls.
Package debug exports debug information for gopls.
golangorgx/gopls/debug/log
Package log provides helper methods for exporting log events to the internal/event package.
Package log provides helper methods for exporting log events to the internal/event package.
golangorgx/gopls/file
The file package defines types used for working with LSP files.
The file package defines types used for working with LSP files.
golangorgx/gopls/filecache
The filecache package provides a file-based shared durable blob cache.
The filecache package provides a file-based shared durable blob cache.
golangorgx/gopls/golang
Package golang defines the LSP features for navigation, analysis, and refactoring of Go source code.
Package golang defines the LSP features for navigation, analysis, and refactoring of Go source code.
golangorgx/gopls/hooks
Package hooks adds all the standard gopls implementations.
Package hooks adds all the standard gopls implementations.
golangorgx/gopls/lsprpc
Package lsprpc implements a jsonrpc2.StreamServer that may be used to serve the LSP on a jsonrpc2 channel.
Package lsprpc implements a jsonrpc2.StreamServer that may be used to serve the LSP on a jsonrpc2 channel.
golangorgx/gopls/progress
The progress package defines utilities for reporting the progress of long-running operations using features of the LSP client interface such as Progress and ShowMessage.
The progress package defines utilities for reporting the progress of long-running operations using features of the LSP client interface such as Progress and ShowMessage.
golangorgx/gopls/protocol
Package protocol contains the structs that map directly to the request and response messages of the Language Server Protocol.
Package protocol contains the structs that map directly to the request and response messages of the Language Server Protocol.
golangorgx/gopls/protocol/command
Package command defines the interface provided by gopls for the workspace/executeCommand LSP request.
Package command defines the interface provided by gopls for the workspace/executeCommand LSP request.
golangorgx/gopls/protocol/semtok
The semtok package provides an encoder for LSP's semantic tokens.
The semtok package provides an encoder for LSP's semantic tokens.
golangorgx/gopls/server
Package server defines gopls' implementation of the LSP server interface, protocol.Server.
Package server defines gopls' implementation of the LSP server interface, protocol.Server.
golangorgx/gopls/template
Package template contains code for dealing with templates
Package template contains code for dealing with templates
golangorgx/gopls/test/integration
Package integration provides a framework for writing integration tests of gopls.
Package integration provides a framework for writing integration tests of gopls.
golangorgx/gopls/test/integration/fake
Package fake provides a fake implementation of an LSP-enabled text editor, its LSP client plugin, and a Sandbox environment for use in integration tests.
Package fake provides a fake implementation of an LSP-enabled text editor, its LSP client plugin, and a Sandbox environment for use in integration tests.
golangorgx/gopls/test/integration/fake/glob
Package glob implements an LSP-compliant glob pattern matcher for testing.
Package glob implements an LSP-compliant glob pattern matcher for testing.
golangorgx/gopls/util/astutil
Package astutil provides various AST utility functions for gopls.
Package astutil provides various AST utility functions for gopls.
golangorgx/gopls/util/browser
Package browser provides utilities for interacting with users' browsers.
Package browser provides utilities for interacting with users' browsers.
golangorgx/gopls/util/bug
Package bug provides utilities for reporting internal bugs, and being notified when they occur.
Package bug provides utilities for reporting internal bugs, and being notified when they occur.
golangorgx/gopls/util/constraints
Package constraints defines a set of useful constraints to be used with type parameters.
Package constraints defines a set of useful constraints to be used with type parameters.
golangorgx/gopls/util/frob
Package frob is a fast restricted object encoder/decoder in the spirit of encoding/gob.
Package frob is a fast restricted object encoder/decoder in the spirit of encoding/gob.
golangorgx/gopls/util/immutable
The immutable package defines immutable wrappers around common data structures.
The immutable package defines immutable wrappers around common data structures.
golangorgx/gopls/util/lru
The lru package implements a fixed-size in-memory LRU cache.
The lru package implements a fixed-size in-memory LRU cache.
golangorgx/gopls/util/persistent
The persistent package defines various persistent data structures; that is, data structures that can be efficiently copied and modified in sublinear time.
The persistent package defines various persistent data structures; that is, data structures that can be efficiently copied and modified in sublinear time.
golangorgx/gopls/util/safetoken
Package safetoken provides wrappers around methods in go/token, that return errors rather than panicking.
Package safetoken provides wrappers around methods in go/token, that return errors rather than panicking.
golangorgx/gopls/version
Package version manages the gopls version.
Package version manages the gopls version.
golangorgx/telemetry/counter
Package counter implements a simple counter system for collecting totally public telemetry data.
Package counter implements a simple counter system for collecting totally public telemetry data.
golangorgx/telemetry/internal/config
package config provides methods for loading and querying a telemetry upload config file.
package config provides methods for loading and querying a telemetry upload config file.
golangorgx/telemetry/internal/configstore
Package configstore abstracts interaction with the telemetry config server.
Package configstore abstracts interaction with the telemetry config server.
golangorgx/telemetry/internal/counter
Package internal/counter implements the internals of the public counter package.
Package internal/counter implements the internals of the public counter package.
golangorgx/telemetry/internal/mmap
The mmap package provides an abstraction for memory mapping files on different platforms.
The mmap package provides an abstraction for memory mapping files on different platforms.
golangorgx/telemetry/internal/telemetry
Package telemetry manages the telemetry mode file.
Package telemetry manages the telemetry mode file.
golangorgx/tools/analysisinternal
Package analysisinternal provides gopls' internal analyses with a number of helper functions that operate on typed syntax trees.
Package analysisinternal provides gopls' internal analyses with a number of helper functions that operate on typed syntax trees.
golangorgx/tools/diff
Package diff computes differences between text files or strings.
Package diff computes differences between text files or strings.
golangorgx/tools/diff/lcs
package lcs contains code to find longest-common-subsequences (and diffs)
package lcs contains code to find longest-common-subsequences (and diffs)
golangorgx/tools/event
Package event provides a set of packages that cover the main concepts of telemetry in an implementation agnostic way.
Package event provides a set of packages that cover the main concepts of telemetry in an implementation agnostic way.
golangorgx/tools/event/core
Package core provides support for event based telemetry.
Package core provides support for event based telemetry.
golangorgx/tools/event/export/metric
Package metric aggregates events into metrics that can be exported.
Package metric aggregates events into metrics that can be exported.
golangorgx/tools/event/export/ocagent
Package ocagent adds the ability to export all telemetry to an ocagent.
Package ocagent adds the ability to export all telemetry to an ocagent.
golangorgx/tools/event/tag
Package tag provides the labels used for telemetry throughout gopls.
Package tag provides the labels used for telemetry throughout gopls.
golangorgx/tools/facts
Package facts defines a serializable set of analysis.Fact.
Package facts defines a serializable set of analysis.Fact.
golangorgx/tools/fuzzy
Package fuzzy implements a fuzzy matching algorithm.
Package fuzzy implements a fuzzy matching algorithm.
golangorgx/tools/gcimporter
Package gcimporter provides various functions for reading gc-generated object files that can be used to implement the Importer interface defined by the Go 1.5 standard library package.
Package gcimporter provides various functions for reading gc-generated object files that can be used to implement the Importer interface defined by the Go 1.5 standard library package.
golangorgx/tools/gocommand
Package gocommand is a helper for calling the go command.
Package gocommand is a helper for calling the go command.
golangorgx/tools/gopathwalk
Package gopathwalk is like filepath.Walk but specialized for finding Go packages, particularly in $GOPATH and $GOROOT.
Package gopathwalk is like filepath.Walk but specialized for finding Go packages, particularly in $GOPATH and $GOROOT.
golangorgx/tools/goroot
Package goroot is a copy of package internal/goroot in the main GO repot.
Package goroot is a copy of package internal/goroot in the main GO repot.
golangorgx/tools/imports
Package imports implements a Go pretty-printer (like package "go/format") that also adds or removes import statements as necessary.
Package imports implements a Go pretty-printer (like package "go/format") that also adds or removes import statements as necessary.
golangorgx/tools/jsonrpc2
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
golangorgx/tools/jsonrpc2/servertest
Package servertest provides utilities for running tests against a remote LSP server.
Package servertest provides utilities for running tests against a remote LSP server.
golangorgx/tools/jsonrpc2_v2
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
golangorgx/tools/memoize
Package memoize defines a "promise" abstraction that enables memoization of the result of calling an expensive but idempotent function.
Package memoize defines a "promise" abstraction that enables memoization of the result of calling an expensive but idempotent function.
golangorgx/tools/packagesinternal
Package packagesinternal exposes internal-only fields from go/packages.
Package packagesinternal exposes internal-only fields from go/packages.
golangorgx/tools/pkgbits
Package pkgbits implements low-level coding abstractions for Unified IR's export data format.
Package pkgbits implements low-level coding abstractions for Unified IR's export data format.
golangorgx/tools/proxydir
Package proxydir provides functions for writing module data to a directory in proxy format, so that it can be used as a module proxy by setting GOPROXY="file://<dir>".
Package proxydir provides functions for writing module data to a directory in proxy format, so that it can be used as a module proxy by setting GOPROXY="file://<dir>".
golangorgx/tools/refactor/inline
Package inline implements inlining of Go function calls.
Package inline implements inlining of Go function calls.
golangorgx/tools/robustio
Package robustio wraps I/O functions that are prone to failure on Windows, transparently retrying errors up to an arbitrary timeout.
Package robustio wraps I/O functions that are prone to failure on Windows, transparently retrying errors up to an arbitrary timeout.
golangorgx/tools/testenv
Package testenv contains helper functions for skipping tests based on which tools are present in the environment.
Package testenv contains helper functions for skipping tests based on which tools are present in the environment.
golangorgx/tools/tokeninternal
package tokeninternal provides access to some internal features of the token package.
package tokeninternal provides access to some internal features of the token package.
golangorgx/tools/tool
Package tool is a harness for writing Go tools.
Package tool is a harness for writing Go tools.
golangorgx/tools/typeparams
Package typeparams contains common utilities for writing tools that interact with generic Go code, as introduced with Go 1.18.
Package typeparams contains common utilities for writing tools that interact with generic Go code, as introduced with Go 1.18.
golangorgx/tools/typesinternal
Package typesinternal provides access to internal go/types APIs that are not yet exported.
Package typesinternal provides access to internal go/types APIs that are not yet exported.
golangorgx/tools/xcontext
Package xcontext is a package to offer the extra functionality we need from contexts that is not available from the standard context package.
Package xcontext is a package to offer the extra functionality we need from contexts that is not available from the standard context package.
mod/mvs
Package mvs implements Minimal Version Selection.
Package mvs implements Minimal Version Selection.
mod/semver
Package semver implements comparison of semantic version strings.
Package semver implements comparison of semantic version strings.
par
Package par implements parallel execution helpers.
Package par implements parallel execution helpers.
pkg
source
Package source contains utility functions that standardize reading source bytes across cue packages.
Package source contains utility functions that standardize reading source bytes across cue packages.
task
Package task provides a registry for tasks to be used by commands.
Package task provides a registry for tasks to be used by commands.
tdtest
Package tdtest provides support for table-driven testing.
Package tdtest provides support for table-driven testing.
value
Package value contains functions for converting values to internal types and various other Value-related utilities.
Package value contains functions for converting values to internal types and various other Value-related utilities.
vcs
Package vcs provides access to operations on the version control systems supported by the source field in module.cue.
Package vcs provides access to operations on the version control systems supported by the source field in module.cue.
mod
modcache
Package modcache provides a file-based cache for modules.
Package modcache provides a file-based cache for modules.
modconfig
Package modconfig provides access to the standard CUE module configuration, including registry access and authorization.
Package modconfig provides access to the standard CUE module configuration, including registry access and authorization.
modfile
Package modfile provides functionality for reading and parsing the CUE module file, cue.mod/module.cue.
Package modfile provides functionality for reading and parsing the CUE module file, cue.mod/module.cue.
modregistry
Package modregistry provides functionality for reading and writing CUE modules from an OCI registry.
Package modregistry provides functionality for reading and writing CUE modules from an OCI registry.
module
Package module defines the Version type along with support code.
Package module defines the Version type along with support code.
modzip
Package modzip provides functions for creating and extracting module zip files.
Package modzip provides functions for creating and extracting module zip files.
pkg
Package pkg defines CUE standard packages.
Package pkg defines CUE standard packages.
crypto/hmac
Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as defined in U.S. Federal Information Processing Standards Publication 198.
Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as defined in U.S. Federal Information Processing Standards Publication 198.
encoding/base64
Package base64 implements base64 encoding as specified by RFC 4648.
Package base64 implements base64 encoding as specified by RFC 4648.
list
Package list contains functions for manipulating and examining lists.
Package list contains functions for manipulating and examining lists.
net
Package net provides net-related type definitions.
Package net provides net-related type definitions.
path
Package path implements utility routines for manipulating filename paths as defined by targetted operating systems, and also paths that always use forward slashes regardless of the operating system, such as URLs.
Package path implements utility routines for manipulating filename paths as defined by targetted operating systems, and also paths that always use forward slashes regardless of the operating system, such as URLs.
regexp
Package regexp implements regular expression search.
Package regexp implements regular expression search.
strings
Package strings implements simple functions to manipulate UTF-8 encoded strings.package strings.
Package strings implements simple functions to manipulate UTF-8 encoded strings.package strings.
struct
Package struct defines utilities for struct types.
Package struct defines utilities for struct types.
time
Package time defines time-related types.
Package time defines time-related types.
tool
Package tool defines stateful operation types for cue commands.
Package tool defines stateful operation types for cue commands.
tool/cli
Package cli provides tasks dealing with a console.
Package cli provides tasks dealing with a console.
tool/exec
Package exec defines tasks for running commands.
Package exec defines tasks for running commands.
tool/file
Package file provides file operations for cue tasks.
Package file provides file operations for cue tasks.
tool/http
Package http provides tasks related to the HTTP protocol.
Package http provides tasks related to the HTTP protocol.
tool/os
Package os defines tasks for retrieving os-related information.
Package os defines tasks for retrieving os-related information.
uuid
Package uuid defines functionality for creating UUIDs as defined in RFC 4122.
Package uuid defines functionality for creating UUIDs as defined in RFC 4122.
tools
fix
Package fix contains functionality for writing CUE files with legacy syntax to newer ones.
Package fix contains functionality for writing CUE files with legacy syntax to newer ones.
flow
Package flow provides a low-level workflow manager based on a CUE Instance.
Package flow provides a low-level workflow manager based on a CUE Instance.
trim
Package trim removes fields that may be inferred from another mixed in value that "dominates" it.
Package trim removes fields that may be inferred from another mixed in value that "dominates" it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL