gopmod

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ClassSpx = &Class{
		ProjExt:  ".gmx",
		WorkExt:  ".spx",
		PkgPaths: []string{"github.com/goplus/spx", "math"},
	}
)
View Source
var (
	ErrNotClassFileMod = errors.New("not a classfile module")
)

Functions

This section is empty.

Types

type Class

type Class = modfile.Classfile

type GopEnv

type GopEnv = env.Gop

type Module

type Module struct {
	modload.Module
	// contains filtered or unexported fields
}

func Load

func Load(dir string, env *GopEnv) (*Module, error)

Load loads a module from a local dir. If we only want to load a Go modfile, pass env parameter as nil.

func LoadMod

func LoadMod(mod module.Version, env *GopEnv) (p *Module, err error)

LoadMod loads a module from a versioned module path. If we only want to load a Go modfile, pass env parameter as nil.

func New

func New(mod modload.Module, env *GopEnv) *Module

New creates a module from a modload.Module instance.

func (*Module) IsClass

func (p *Module) IsClass(ext string) (isProj bool, ok bool)

func (*Module) IsGopMod

func (p *Module) IsGopMod() bool

IsGopMod returns if this module is a Go+ module or not.

func (*Module) Lookup

func (p *Module) Lookup(pkgPath string) (pkg *Package, err error)

func (*Module) LookupClass

func (p *Module) LookupClass(ext string) (c *Class, ok bool)

func (*Module) LookupDepMod

func (p *Module) LookupDepMod(modPath string) (modVer module.Version, ok bool)

LookupDepMod lookups a depended module. If modVer.Path is replace to be a local path, it will be canonical to an absolute path.

func (*Module) LookupExternPkg

func (p *Module) LookupExternPkg(pkgPath string) (modPath string, modVer module.Version, ok bool)

LookupExternPkg lookups a external package from depended modules. If modVer.Path is replace to be a local path, it will be canonical to an absolute path.

func (*Module) PkgType

func (p *Module) PkgType(pkgPath string) PkgType

PkgType returns the package type of specified package.

func (*Module) RegisterClasses

func (p *Module) RegisterClasses(registerClass ...func(c *Class)) (err error)

type Package

type Package struct {
	Type    PkgType
	Dir     string
	ModDir  string
	ModPath string
}

type PkgType

type PkgType int

PkgType specifies a package type.

const (
	PkgtStandard PkgType = iota // a standard Go/Go+ package
	PkgtModule                  // a package in this module (in standard form)
	PkgtLocal                   // a package in this module (in relative path form)
	PkgtExtern                  // an extarnal package
	PkgtInvalid  = -1           // an invalid package
)

Jump to

Keyboard shortcuts

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