modutil

package
v6.0.0-...-a3052e6 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PkgTypeStd - a std module
	PkgTypeStd = fastmod.PkgTypeGoroot

	// PkgTypeGopath - a module found at $GOPATH/src
	PkgTypeGopath = fastmod.PkgTypeGoroot

	// PkgTypeThis - this module itself
	PkgTypeThis = fastmod.PkgTypeMod

	// PkgTypeChild - child module of this module
	PkgTypeChild = fastmod.PkgTypeLocal

	// PkgTypeDepMod - a depended module found at $GOPATH/pkg/mod
	PkgTypeDepMod = fastmod.PkgTypeDepMod

	// PkgTypeLocalDep - a module that rewrites to local
	PkgTypeLocalDep = fastmod.PkgTypeLocalMod
)

Variables

View Source
var (
	// BuildContext is the default build context.
	BuildContext = &build.Default
)

Functions

func LookupModFile

func LookupModFile(dir string) (file string, err error)

LookupModFile finds go.mod file for a package directory.

Types

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module represents a loaded module.

func LoadModule

func LoadModule(dir string) (mod *Module, err error)

LoadModule loads a module from specified dir.

func (Module) Lookup

func (p Module) Lookup(pkg string) (pi PackageInfo, err error)

Lookup returns package info, if found.

func (Module) ModFile

func (p Module) ModFile() string

ModFile returns `go.mod` file path of this module. eg. `$HOME/work/qiniu/qlang/go.mod`

func (Module) PkgPath

func (p Module) PkgPath() string

PkgPath returns PkgPath of this module. eg. `github.com/qiniu/qlang/v6`

func (Module) RootPath

func (p Module) RootPath() string

RootPath returns root path of this module. eg. `$HOME/work/qiniu/qlang`

func (Module) VersionPkgPath

func (p Module) VersionPkgPath() string

VersionPkgPath returns VersionPkgPath of this module. eg. `github.com/qiniu/qlang/v6@v1.0.0`

type PackageInfo

type PackageInfo struct {
	Location       string
	VersionPkgPath string
	Type           PkgType
}

PackageInfo represents a package info.

type PkgType

type PkgType = fastmod.PkgType

PkgType represents a package type.

Jump to

Keyboard shortcuts

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