gocuelang.org/go/internal/mod/modimports Index | Files

package modimports

import "cuelang.org/go/internal/mod/modimports"

Index

Functions

func AllImports

func AllImports(modFilesIter func(func(ModuleFile, error) bool)) (_ []string, retErr error)

AllImports returns a sorted list of all the package paths imported by the module files produced by modFilesIter in canonical form.

func AllModuleFiles

func AllModuleFiles(fsys fs.FS, root string) func(func(ModuleFile, error) bool)

AllModuleFiles returns an iterator that produces all the CUE files inside the module at the given root.

The caller may assume that files from the same package are always adjacent.

func PackageFiles

func PackageFiles(fsys fs.FS, dir string, pkgQualifier string) func(func(ModuleFile, error) bool)

PackageFiles returns an iterator that produces all the CUE files inside the package with the given name at the given location. If pkgQualifier is "*", files from all packages in the directory will be produced.

TODO(mvdan): this should now be called InstanceFiles, to follow the naming from https://cuelang.org/docs/concept/modules-packages-instances/#instances.

Types

type ModuleFile

type ModuleFile struct {
	// FilePath holds the path of the module file
	// relative to the root of the fs. This will be
	// valid even if there's an associated error.
	//
	// If there's an error, it might not a be CUE file.
	FilePath string

	// Syntax includes only the portion of the file up to and including
	// the imports. It will be nil if there was an error reading the file.
	Syntax *ast.File
}

Source Files

modimports.go

Version
v0.12.0 (latest)
Published
Jan 30, 2025
Platform
linux/amd64
Imports
11 packages
Last checked
8 hours ago

Tools for package owners.