mod

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetModFile

func GetModFile(modulePath, version string) (*modfile.File, error)

GetLatestVersion returns the go.mod file of a module.

func ListVersions

func ListVersions(modulePath string) ([]string, error)

ListVersions lists all versions of a module. Sorts the versions in descending order by semver.

func SetDefaultClient

func SetDefaultClient(c *http.Client)

func SetGoProxy added in v0.1.5

func SetGoProxy(proxy string)

Types

type Module added in v0.1.8

type Module struct {
	Path       string       // module path
	Query      string       // version query corresponding to this version
	Version    string       // module version
	Versions   []string     // available module versions
	Replace    *Module      // replaced by this module
	Time       *time.Time   // time version was created
	Update     *Module      // available update (with -u)
	Main       bool         // is this the main module?
	Indirect   bool         // module is only indirectly needed by main module
	Dir        string       // directory holding local copy of files, if any
	GoMod      string       // path to go.mod file describing module, if any
	GoVersion  string       // go version used in module
	Retracted  []string     // retraction information, if any (with -retracted or -u)
	Deprecated string       // deprecation message, if any (with -u)
	Error      *ModuleError // error loading module
	Sum        string       // checksum for path, version (as in go.sum)
	GoModSum   string       // checksum for go.mod (as in go.sum)
	Origin     any          // provenance of module
	Reuse      bool         // reuse of old module info is safe
}

func ListAllModules added in v0.1.8

func ListAllModules(dir string) ([]Module, error)

type ModuleError added in v0.1.8

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