Documentation
¶
Index ¶
- Constants
- Variables
- type Module
- func (p Module) AddCompiler(compiler, ver string)
- func (p Module) AddRequire(path, vers string, hasProj bool) error
- func (p Module) DepMods() map[string]module.Version
- func (p Module) HasModfile() bool
- func (p Module) HasProject() bool
- func (p Module) Modfile() string
- func (p Module) Path() string
- func (p Module) Projects() []*modfile.Project
- func (p Module) Root() string
- func (p Module) Save() (err error)
- func (p Module) SaveWithGopMod(gop *env.Gop, flags int) (err error)
Constants ¶
View Source
const ( FlagDepModGop = 1 << iota // depends module github.com/goplus/gop FlagDepModX // depends module github.com/qiniu/x )
Variables ¶
View Source
var ( ErrNoModDecl = errors.New("no module declaration in a .mod file") ErrNoModRoot = errors.New("go.mod file not found in current directory or any parent directory") ErrSaveDefault = errors.New("attemp to save default project") )
View Source
var Default = Module{ File: &gomodfile.File{ Module: &gomodfile.Module{}, Go: &gomodfile.Go{Version: defaultGoVer}, }, Opt: &modfile.File{ Gop: &modfile.Gop{Version: defaultGopVer}, }, }
Default represents the default gop.mod object.
Functions ¶
This section is empty.
Types ¶
type Module ¶
func Create ¶
Create creates a new module in `dir`. You should call `Save` manually to save this module.
func LoadFrom ¶ added in v0.11.9
LoadFrom loads a module from specified go.mod file and an optional gop.mod file.
func LoadFromEx ¶ added in v0.12.2
LoadFromEx loads a module from specified go.mod file and an optional gop.mod file. It can specify a customized `readFile` to read file content.
func (Module) AddCompiler ¶ added in v0.13.12
AddCompiler adds a custom Go compiler to this module.
func (Module) AddRequire ¶ added in v0.13.0
AddRequire adds a require package to this module.
func (Module) DepMods ¶
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) HasModfile ¶ added in v0.12.1
HasModfile returns if this module exists or not.
func (Module) HasProject ¶ added in v0.12.0
Click to show internal directories.
Click to hide internal directories.