modload

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: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GoModOnly = mod.GoModOnly
)

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 ExecCmdError

type ExecCmdError struct {
	Err    error
	Stderr []byte
}

func (*ExecCmdError) Error

func (p *ExecCmdError) Error() string

type GopEnv

type GopEnv = env.Gop

type Mode added in v0.9.1

type Mode = mod.Mode

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 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) Tidy

func (p Module) Tidy(env *GopEnv) (err error)

Tidy adds missing and removes unused modules. Note: please call GenGo before Tidy.

func (Module) UpdateGoMod

func (p Module) UpdateGoMod(env *GopEnv, 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