gomodules

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: MPL-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModGraph added in v1.0.0

func ModGraph(filename string) (graph.Deps, error)

ModGraph returns the dependencies found in a `go.mod` file. We cannot resolve a graph so we make all dependencies direct.

func ModulePath added in v1.1.4

func ModulePath(modFile string) (string, error)

Return the "module path" from a go.mod file

A file containing:

module example.com/foo

Returns "example.com/foo"

func SumGraph added in v1.0.0

func SumGraph(filename string) (graph.Deps, error)

SumGraph returns the dependencies found in a `go.sum` file. We cannot resolve a graph so we make all dependencies direct. Note `go.sum` includes dependencies which are not used and this may be inaccurate. https://github.com/golang/go/wiki/Modules#is-gosum-a-lock-file-why-does-gosum-include-information-for-module-versions-i-am-no-longer-using

Types

type Resolver

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

Resolver maps modules from import paths to their pkg.Import representation.

func Mock

func Mock(modules string) (Resolver, error)

Mock creates a golang.Resolver using any string input.

func New

func New(dir string) (Resolver, error)

New connects goModuleList and a parser to return a golang.Resolver.

func (Resolver) Resolve

func (r Resolver) Resolve(importpath string) (pkg.Import, error)

Resolve calculates a package's module path from its import path, and returns the resolved pkg.Import for the module path.

Jump to

Keyboard shortcuts

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