modload

package
v0.9.11 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoModDecl = errors.New("no module declaration in gop.mod (or go.mod)")
	ErrNoModRoot = errors.New("gop.mod or go.mod file not found in current directory or any parent directory")
)

Functions

This section is empty.

Types

type Module

type Module struct {
	*modfile.File
}

func Create

func Create(dir string, modPath, goVer, gopVer string) (p Module, err error)

Create creates a new module in `dir`. You should call `Save` manually to save this module.

func Load

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

Load loads a module from `dir`.

func (Module) DepMods

func (p Module) DepMods() map[string]module.Version

DepMods returns all depended modules. If a depended module path is replace to be a local path, it will be canonical to an absolute path.

func (Module) Modfile

func (p Module) Modfile() string

Modfile returns absolute path of the module file (gop.mod or go.mod).

func (Module) Path

func (p Module) Path() string

Path returns the module path.

func (Module) Root

func (p Module) Root() string

Root returns absolute root path of this module.

func (Module) Save

func (p Module) Save() error

Save saves all changes of this module.

func (Module) UpdateGoMod

func (p Module) UpdateGoMod(env *env.Gop, checkChanged bool) error

UpdateGoMod updates the go.mod file.

Jump to

Keyboard shortcuts

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