cl

package
v1.0.0-beta2 Latest Latest
Warning

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

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

Documentation

Overview

Package cl compiles Go+ syntax trees (ast).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindGoModFile added in v0.9.0

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

func GetModulePath added in v0.9.0

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

func NewPackage added in v0.7.0

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

NewPackage creates a Go+ package instance.

func SetDisableRecover added in v1.0.0

func SetDisableRecover(disableRecover bool)

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

	// WorkingDir is the directory in which to run gop compiler.
	// TargetDir is the directory in which to generate Go files.
	// If WorkingDir or TargetDir is empty, it is same as Dir.
	WorkingDir, TargetDir 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

	// Fset provides source position information for syntax trees and types.
	// If Fset is nil, Load will use a new fileset, but preserve Fset's value.
	Fset *token.FileSet

	// GenGoPkg is called to convert a Go+ package into Go.
	GenGoPkg func(pkgDir string, base *Config) error

	// PkgsLoader is the Go+ packages loader (will be set if it is nil).
	PkgsLoader *PkgsLoader

	// CacheLoadPkgs means to cache all loaded packages (or not).
	CacheLoadPkgs bool

	// NoFileLine = true means not to generate file line comments.
	NoFileLine bool
}

Config of loading Go+ packages.

func (*Config) Ensure added in v0.9.2

func (conf *Config) Ensure() *Config

type Errors added in v0.9.2

type Errors struct {
	Errs []error
}

func (*Errors) Error added in v0.9.2

func (p *Errors) Error() string

type PkgsLoader added in v0.9.2

type PkgsLoader struct {
	LoadPkgs   gox.LoadPkgsFunc
	BaseConfig *Config
	// contains filtered or unexported fields
}

func (*PkgsLoader) GenGoPkgs added in v0.9.2

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

func (*PkgsLoader) Load added in v0.9.2

func (p *PkgsLoader) Load(cfg *packages.Config, patterns ...string) ([]*packages.Package, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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