Documentation
¶
Index ¶
- Variables
- func BuildDir(dir string, conf *Config, build *gocmd.BuildConfig, flags ...GenFlags) (err error)
- func BuildFiles(files []string, conf *Config, build *gocmd.BuildConfig) (err error)
- func BuildPkgPath(workDir, pkgPath string, conf *Config, build *gocmd.BuildConfig, ...) (err error)
- func ErrorPos(err error) token.Pos
- func FilterNoTestFiles(fi fs.FileInfo) bool
- func GenGo(dir string, conf *Config, genTestPkg bool) (string, bool, error)
- func GenGoEx(dir string, conf *Config, genTestPkg bool, flags GenFlags) (string, bool, error)
- func GenGoFiles(autogen string, files []string, conf *Config) (outFiles []string, err error)
- func GenGoPkgPath(workDir, pkgPath string, conf *Config, allowExtern bool) (localDir string, recursively bool, err error)
- func GenGoPkgPathEx(workDir, pkgPath string, conf *Config, allowExtern bool, flags GenFlags) (localDir string, recursively bool, err error)
- func GetFileClassType(mod *xgomod.Module, file *ast.File, filename string) (classType string, isTest bool)
- func IgnoreNotated(err error) bool
- func InstallDir(dir string, conf *Config, install *gocmd.InstallConfig, flags ...GenFlags) (err error)
- func InstallFiles(files []string, conf *Config, install *gocmd.InstallConfig) (err error)
- func InstallPkgPath(workDir, pkgPath string, conf *Config, install *gocmd.InstallConfig, ...) (err error)
- func LoadDir(dir string, conf *Config, genTestPkg bool, promptGenGo ...bool) (out, test *gogen.Package, err error)
- func LoadFiles(dir string, files []string, conf *Config) (out *gogen.Package, err error)
- func LoadMod(dir string) (mod *xgomod.Module, err error)
- func NotFound(err error) bool
- func Outline(dir string, conf *Config) (out outline.Package, err error)
- func OutlinePkgPath(workDir, pkgPath string, conf *Config, allowExtern bool) (out outline.Package, err error)
- func Pack(dir string, flags PackFlags) error
- func PackProject(fsys fs.ReadDirFS, dir string, indexFile string) (indexPackContent []byte, err error)
- func RunDir(dir string, args []string, conf *Config, run *gocmd.RunConfig, ...) (err error)
- func RunFiles(autogen string, files []string, args []string, conf *Config, ...) (err error)
- func RunPkgPath(pkgPath string, args []string, chDir bool, conf *Config, run *gocmd.RunConfig, ...) (err error)
- func TestDir(dir string, conf *Config, test *gocmd.TestConfig, flags ...GenFlags) (err error)
- func TestFiles(files []string, conf *Config, test *gocmd.TestConfig) (err error)
- func TestPkgPath(workDir, pkgPath string, conf *Config, test *gocmd.TestConfig, ...) (err error)
- func Tidy(dir string, xgo *env.XGo) (err error)
- type ConfFlags
- type Config
- type GenFlags
- type Importer
- type PackFlags
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = xgomod.ErrNotFound ErrIgnoreNotated = errors.New("notated error ignored") )
var ( ErrMultiPackges = errors.New("multiple packages") ErrMultiTestPackges = errors.New("multiple test packages") )
Functions ¶
func BuildFiles ¶
func BuildFiles(files []string, conf *Config, build *gocmd.BuildConfig) (err error)
BuildFiles builds specified XGo files.
func BuildPkgPath ¶
func BuildPkgPath(workDir, pkgPath string, conf *Config, build *gocmd.BuildConfig, flags ...GenFlags) (err error)
BuildPkgPath builds an XGo package.
func FilterNoTestFiles ¶
FilterNoTestFiles filters to skip all testing files.
func GenGoFiles ¶
GenGoFiles generates xgo_autogen.go for specified XGo files.
func GenGoPkgPath ¶
func GenGoPkgPath(workDir, pkgPath string, conf *Config, allowExtern bool) (localDir string, recursively bool, err error)
GenGoPkgPath generates xgo_autogen.go for an XGo package.
func GenGoPkgPathEx ¶
func GenGoPkgPathEx(workDir, pkgPath string, conf *Config, allowExtern bool, flags GenFlags) (localDir string, recursively bool, err error)
GenGoPkgPathEx generates xgo_autogen.go for an XGo package.
func GetFileClassType ¶
func GetFileClassType(mod *xgomod.Module, file *ast.File, filename string) (classType string, isTest bool)
GetFileClassType get xgo module file classType.
func IgnoreNotated ¶
IgnoreNotated returns if cause err is ErrIgnoreNotated or not.
func InstallDir ¶
func InstallDir(dir string, conf *Config, install *gocmd.InstallConfig, flags ...GenFlags) (err error)
InstallDir installs an XGo package directory.
func InstallFiles ¶
func InstallFiles(files []string, conf *Config, install *gocmd.InstallConfig) (err error)
InstallFiles installs specified XGo files.
func InstallPkgPath ¶
func InstallPkgPath(workDir, pkgPath string, conf *Config, install *gocmd.InstallConfig, flags ...GenFlags) (err error)
InstallPkgPath installs an XGo package.
func LoadDir ¶
func LoadDir(dir string, conf *Config, genTestPkg bool, promptGenGo ...bool) (out, test *gogen.Package, err error)
LoadDir loads XGo packages from a specified directory.
func OutlinePkgPath ¶
func Pack ¶ added in v1.7.1
Pack discovers pack roots in the directory tree rooted at dir, merges child configuration files into each root, and writes the packed output.
In test mode (PackFlagTest), no files are written; instead Pack verifies that every index_pack.* file already exists and matches the expected content.
func PackProject ¶ added in v1.7.1
func PackProject( fsys fs.ReadDirFS, dir string, indexFile string, ) (indexPackContent []byte, err error)
PackProject merges all indexFile configuration files found under dir into a single packed document and returns its serialised content.
fsys is the filesystem to read from (may be a ZIP-backed fs.ReadDirFS). dir is the root directory within fsys that contains the root configuration file. indexFile is the filename of the root configuration file (e.g. "index.json").
The returned []byte is the fully-merged configuration in the same format as indexFile (JSON, YAML, or YAML with .yml extension). The caller is responsible for writing or caching the result; PackProject never writes to any filesystem.
func RunDir ¶
func RunDir(dir string, args []string, conf *Config, run *gocmd.RunConfig, flags ...GenFlags) (err error)
RunDir runs an application from an XGo package directory.
func RunFiles ¶
func RunFiles(autogen string, files []string, args []string, conf *Config, run *gocmd.RunConfig) (err error)
RunFiles runs an application from specified XGo files.
func RunPkgPath ¶
func RunPkgPath(pkgPath string, args []string, chDir bool, conf *Config, run *gocmd.RunConfig, flags ...GenFlags) (err error)
RunPkgPath runs an application from an XGo package.
func TestFiles ¶
func TestFiles(files []string, conf *Config, test *gocmd.TestConfig) (err error)
TestFiles tests specified XGo files.
func TestPkgPath ¶
func TestPkgPath(workDir, pkgPath string, conf *Config, test *gocmd.TestConfig, flags ...GenFlags) (err error)
TestPkgPath tests an XGo package.
Types ¶
type Config ¶
type Config struct {
XGo *env.XGo
Fset *token.FileSet
Mod *xgomod.Module
Importer *Importer
Filter func(fs.FileInfo) bool
// If not nil, it is used for returning result of checks XGo dependencies.
// see https://pkg.go.dev/github.com/goplus/gogen#File.CheckGopDeps
XGoDeps *int
// CacheFile specifies the file path of the cache.
CacheFile string
IgnoreNotatedError bool
DontUpdateGoMod bool
}
Config represents a configuration for loading XGo packages.
func NewDefaultConf ¶
NewDefaultConf creates a dfault configuration for common cases.
func (*Config) NewGoCmdConf ¶
func (*Config) UpdateCache ¶
UpdateCache updates the cache.
type Importer ¶
type Importer struct {
Flags GenFlags // can change this for loading XGo modules
// contains filtered or unexported fields
}
Importer represents an XGo importer.
func NewImporter ¶
NewImporter creates an XGo Importer.