Documentation ¶
Index ¶
- Variables
- func Absolute(dir string) (abs string, err error)
- func Infer(dir string) string
- func WithModCache(cache *modcache.Cache) func(o *option)
- type File
- func (f *File) AddReplace(oldPath, oldVers, newPath, newVers string) error
- func (f *File) AddRequire(importPath, version string) error
- func (f *File) Format() []byte
- func (f *File) Import(subPaths ...string) string
- func (f *File) Replace(path string) *module.Version
- func (f *File) Replaces() (reps []*Replace)
- func (f *File) Require(path string) *module.Version
- func (f *File) Requires() (reqs []*Require)
- type Module
- func (m *Module) Directory(subpaths ...string) string
- func (m *Module) File() *File
- func (m *Module) Find(importPath string) (*Module, error)
- func (m *Module) FindBy(match func(req *Require) bool) (modules []*Module, err error)
- func (m *Module) FindIn(fsys fs.FS, importPath string) (*Module, error)
- func (m *Module) Hash() []byte
- func (m *Module) Import(subpaths ...string) string
- func (m *Module) IsLocal(importPath string) bool
- func (m *Module) MkdirAll(path string, perm fs.FileMode) error
- func (m *Module) ModCache() string
- func (m *Module) Open(name string) (fs.File, error)
- func (m *Module) ReadDir(name string) ([]fs.DirEntry, error)
- func (m *Module) RemoveAll(path string) error
- func (m *Module) ResolveDirectory(importPath string) (directory string, err error)
- func (m *Module) ResolveDirectoryIn(localFS fs.FS, importPath string) (directory string, err error)
- func (m *Module) ResolveImport(directory string) (importPath string, err error)
- func (m *Module) Stat(name string) (fs.FileInfo, error)
- func (m *Module) Sub(dir string) (virtual.FS, error)
- func (m *Module) WriteFile(name string, data []byte, perm fs.FileMode) error
- type Option
- type Replace
- type Require
- type Version
Constants ¶
This section is empty.
Variables ¶
var ErrCantInfer = errors.New("mod: unable to infer the module path")
ErrCantInfer occurs when you can't infer the module path from the $GOPATH.
var ErrFileNotFound = fmt.Errorf("unable to find go.mod: %w", fs.ErrNotExist)
ErrFileNotFound occurs when no go.mod can be found
Functions ¶
func Absolute ¶
Absolute traverses up the filesystem until it finds a directory containing go.mod or returns an error trying.
func WithModCache ¶
WithModCache uses a custom mod cache instead of the default
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) AddReplace ¶
func (*File) AddRequire ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func FindBudModule ¶ added in v0.2.6
FindBudModule finds the go.mod for bud itself
func (*Module) FindIn ¶
Find a dependency from an import path within fsys Note: go.mod itself needs to really be in the filesystem
func (*Module) MkdirAll ¶ added in v0.2.5
MkdirAll creates dir within the module dir. Used to implement virtual.FS
func (*Module) RemoveAll ¶ added in v0.2.5
RemoveAll removes a file within the module dir. Used to implement virtual.FS.
func (*Module) ResolveDirectory ¶
ResolveDirectory resolves an import to an absolute path
func (*Module) ResolveDirectoryIn ¶
ResolveDirectory resolves an import to an absolute path. LocalFS maybe used if we're resolving an import path from within the current modules filesystem.
func (*Module) ResolveImport ¶
ResolveImport returns an import path from a local directory.