modutils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ModPackageFileError  = eris.New("could not find mod package file")
	NonGoModPackageError = eris.New("path could not be found, as this function must be run from within a" +
		"go.mod package")

	EmptyFileError = eris.New("empty file supplied, must be")

	UnableToListPackagesError = eris.New("unable to list dependencies for current go.mod packages")
)

Functions

func GetCurrentModPackageFile

func GetCurrentModPackageFile() (string, error)

Returns the current go mod package Ex: /path/to/solo-kit/go.mod

Will return /dev/null on unix if not in a go.mod package

func GetCurrentModPackageName

func GetCurrentModPackageName(module string) (string, error)

Returns the current go mod package name from the go.mod file. Use the function below to get the filename Ex: github.com/solo-io/solo-kit

func GetCurrentPackageListAll

func GetCurrentPackageListAll() (*bytes.Buffer, error)

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 for this module, if any
	GoVersion string       // go version used in module
	Error     *ModuleError // error loading module
}

mirror of https://golang.org/src/cmd/go/internal/list/list.go used to unmarshal output of `go list -m json`

func GetCurrentPackageListJson

func GetCurrentPackageListJson(modules []string) ([]*Module, error)

type ModuleError

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

Jump to

Keyboard shortcuts

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