cl

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: Apache-2.0 Imports: 20 Imported by: 2

Documentation

Overview

Package cl compiles Go+ syntax trees (ast).

Index

Constants

This section is empty.

Variables

View Source
var (
	GenGoPkg func(pkgDir string) error
	GopGo    func(cfg *packages.Config, notFounds []string) error
)

Functions

func FindGoModFile added in v0.9.0

func FindGoModFile(dir string) (file string, err error)

func GenGoPkgs added in v0.9.0

func GenGoPkgs(cfg *packages.Config, notFounds []string) (err error)

func GetModulePath added in v0.9.0

func GetModulePath(file string) (pkgPath string, err error)

func LoadGop added in v0.9.0

func LoadGop(cfg *packages.Config, patterns ...string) ([]*packages.Package, error)

func LoadGopPkgs added in v0.9.0

func LoadGopPkgs(at *gox.Package, importPkgs map[string]*gox.PkgRef, pkgPaths ...string) int

LoadGopPkgs loads and returns the Go+ packages named by the given pkgPaths.

func NewPackage added in v0.7.0

func NewPackage(
	pkgPath string, pkg *ast.Package, fset *token.FileSet, conf *Config) (p *gox.Package, err error)

NewPackage creates a Go+ package instance.

Types

type Config added in v0.9.0

type Config struct {
	// Context specifies the context for the load operation.
	// If the context is cancelled, the loader may stop early
	// and return an ErrCancelled error.
	// If Context is nil, the load cannot be cancelled.
	Context context.Context

	// Logf is the logger for the config.
	// If the user provides a logger, debug logging is enabled.
	// If the GOPACKAGESDEBUG environment variable is set to true,
	// but the logger is nil, default to log.Printf.
	Logf func(format string, args ...interface{})

	// Dir is the directory in which to run the build system's query tool
	// that provides information about the packages.
	// If Dir is empty, the tool is run in the current directory.
	Dir string

	// Env is the environment to use when invoking the build system's query tool.
	// If Env is nil, the current environment is used.
	// As in os/exec's Cmd, only the last value in the slice for
	// each environment key is used. To specify the setting of only
	// a few variables, append to the current environment, as in:
	//
	//	opt.Env = append(os.Environ(), "GOOS=plan9", "GOARCH=386")
	//
	Env []string

	// BuildFlags is a list of command-line flags to be passed through to
	// the build system's query tool.
	BuildFlags []string

	// LoadPkgs is called to load all import packages.
	LoadPkgs gox.LoadPkgsFunc
}

Config of loading Go+ packages.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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