gomod

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: Apache-2.0 Imports: 12 Imported by: 2

README

gomod

load go mod util

mpkg, err := gomod.Load(dir)
pkg, dir, found := mpkg.Lookup(pkg)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module struct {
	Path      string       // module path
	Version   string       // module version
	Versions  []string     // available module versions (with -versions)
	Replace   *Module      // replaced by this module
	Time      *time.Time   // time version was created
	Update    *Module      // available update, if any (with -u)
	Main      bool         // is this the main module?
	Indirect  bool         // is this module only an indirect dependency of main module?
	Dir       string       // directory holding files for this module, if any
	GoMod     string       // path to go.mod file used when loading this module, if any
	GoVersion string       // go version used in module
	Retracted string       // retraction information, if any (with -retracted or -u)
	Error     *ModuleError // error loading module
}

func (*Module) String

func (m *Module) String() string

type ModuleError

type ModuleError struct {
	Err string // the error itself
}

type Package

type Package struct {
	List []*Module
	// contains filtered or unexported fields
}

func Load

func Load(dir string, ctx *build.Context) (*Package, error)

func (*Package) DepImportList added in v0.0.2

func (p *Package) DepImportList(skipcmd bool, chkmodsub bool) (list []string)

func (*Package) IsStd

func (p *Package) IsStd() bool

func (*Package) LocalImportList added in v0.0.2

func (p *Package) LocalImportList(skipcmd bool) []string

func (*Package) Lookup

func (p *Package) Lookup(pkg string) (path string, dir string, found bool)

func (*Package) Root

func (p *Package) Root() *Module

type PathPkgsIndex added in v0.0.2

type PathPkgsIndex struct {
	Indexs []*PkgsIndex
}

func (*PathPkgsIndex) LoadIndex added in v0.0.2

func (p *PathPkgsIndex) LoadIndex(context build.Context, srcDirs ...string)

func (*PathPkgsIndex) Sort added in v0.0.2

func (p *PathPkgsIndex) Sort()

type PkgSlice added in v0.0.2

type PkgSlice []*build.Package

func (PkgSlice) Len added in v0.0.2

func (p PkgSlice) Len() int

func (PkgSlice) Less added in v0.0.2

func (p PkgSlice) Less(i, j int) bool

func (PkgSlice) Swap added in v0.0.2

func (p PkgSlice) Swap(i, j int)

type PkgsIndex added in v0.0.2

type PkgsIndex struct {
	sync.Mutex
	Pkgs []*build.Package
}

Jump to

Keyboard shortcuts

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