Documentation ¶
Overview ¶
Package cl compiles Go+ syntax trees (ast).
Index ¶
- Constants
- func FindGoModFile(dir string) (file string, err error)
- func GetModulePath(file string) (pkgPath string, err error)
- func NewPackage(pkgPath string, pkg *ast.Package, conf *Config) (p *gox.Package, err error)
- func SetDebug(flags int)
- func SetDisableRecover(disableRecover bool)
- type Config
- type Errors
- type PkgsLoader
Constants ¶
View Source
const ( DbgFlagLoad = 1 << iota DbgFlagLookup DbgFlagAll = DbgFlagLoad | DbgFlagLookup )
Variables ¶
This section is empty.
Functions ¶
func FindGoModFile ¶ added in v0.9.0
func GetModulePath ¶ added in v0.9.0
func NewPackage ¶ added in v0.7.0
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 // ModPath specifies module path. ModPath string // ModRootDir specifies root dir of this module. // If ModRootDir is empty, will lookup go.mod in all ancestor directories of Dir. // If you specify ModPath, you should specify ModRootDir at the same time. ModRootDir string // CacheFile specifies where cache data to write. CacheFile 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 = true means to cache all loaded packages. CacheLoadPkgs bool // PersistLoadPkgs = true means to cache all loaded packages to disk. PersistLoadPkgs bool // NoFileLine = true means not to generate file line comments. NoFileLine bool // RelativePath = true means to generate file line comments with relative file path. RelativePath bool }
Config of loading Go+ packages.
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) Save ¶ added in v1.0.0
func (p *PkgsLoader) Save() error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.