cueimports

package module
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: MIT Imports: 13 Imported by: 0

README

cueimports

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

Install

go install github.com/asdine/cueimports/cmd/cueimports

Usage

$ echo "data: json.Marshal({a: math.Sqrt(7)})" | cueimports
import (
	"encoding/json"
	"math"
)

data: json.Marshal({a: math.Sqrt(7)})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Import

func Import(filename string, content []byte) ([]byte, error)

Import reads the given cue file and updates the import statements, adding missing ones and removing unused ones. If content is nil, the file is read from disk, otherwise the content is used without reading the file. It returns the update file content.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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