cueimports is a CUE tool that updates your import lines, adding missing ones and removing unused ones.
It scans through:
- your local packages
- the cue.mod directory packages
- the standard library packages
go install github.com/asdine/cueimports/cmd/cueimports
$ echo "data: json.Marshal({a: math.Sqrt(7)})" | cueimports
import (
"encoding/json"
"math"
)
data: json.Marshal({a: math.Sqrt(7)})