gopmod

package
v0.11.9 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = New(modload.Default)

Default represents the default gop.mod object.

View Source
var (
	ErrNotClassFileMod = errors.New("not a classfile module")
)
View Source
var (
	SpxProject = &Project{
		Ext:      ".spx",
		Class:    "Game",
		Works:    []*Class{{Ext: ".spx", Class: "Sprite"}},
		PkgPaths: []string{"github.com/goplus/spx", "math"},
	}
)

Functions

This section is empty.

Types

type Class

type Class = modfile.Class

type MissingError added in v0.9.11

type MissingError struct {
	Path string
}

func (*MissingError) Error added in v0.9.11

func (e *MissingError) Error() string

type Module

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

func Load

func Load(dir string, mode mod.Mode) (*Module, error)

Load loads a module from a local directory.

func LoadFrom added in v0.11.9

func LoadFrom(file string) (*Module, error)

LoadFrom loads a module from specified gop.mod or go.mod file.

func LoadMod

func LoadMod(mod module.Version, mode mod.Mode) (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) *Module

New creates a module from a modload.Module instance.

func (*Module) ClassKind added in v0.11.1

func (p *Module) ClassKind(fname string) (isProj, ok bool)

func (*Module) ImportClasses added in v0.11.1

func (p *Module) ImportClasses(importClass ...func(c *Project)) (err error)

func (*Module) IsClass

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

func (*Module) IsGopMod

func (p *Module) IsGopMod() bool

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

func (*Module) IsValid added in v0.9.7

func (p *Module) IsValid() bool

IsValid returns if this module exists 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 *Project, 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) PkgType

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

PkgType returns the package type of specified package.

type Package

type Package struct {
	Type    PkgType
	Dir     string
	ModDir  string
	ModPath string
	Real    module.Version // only when Type == PkgtExtern
}

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
)

type Project added in v0.10.0

type Project = modfile.Project

Jump to

Keyboard shortcuts

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