package fix

import "cuelang.org/go/tools/fix"

Package fix contains functionality for writing CUE files with legacy syntax to newer ones.

Note: the transformations that are supported in this package will change over time.

Index

Functions

func File

func File(f *ast.File, o ...Option) *ast.File

File applies fixes to f and returns it. It alters the original f.

func Instances

func Instances(a []*build.Instance, o ...Option) errors.Error

Instances modifies all files contained in the given build instances at once.

It also applies the fixes from File.

Types

type Option

type Option func(*options)

func Experiments

func Experiments(experiment ...string) Option

Experiments enables fixes for specific experiments. Depending on the version of the module, this may result in adding an @experiment attribute to the top of the file for the given experiment.

func Simplify

func Simplify() Option

Simplify enables fixes that simplify the code, but are not strictly necessary.

func UpgradeVersion

func UpgradeVersion(version string) Option

UpgradeVersion enables upgrade fixes to the specified language version, applying all accepted experiments up to that version.

Source Files

fix.go fixall.go simplify.go

Version
v0.15.1 (latest)
Published
Nov 21, 2025
Platform
linux/amd64
Imports
11 packages
Last checked
4 months ago

Tools for package owners.