modproxy

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentVersion

func GetCurrentVersion(g Getter, mod string, includePrerelease bool) (string, error)

GetCurrentVersion returns the highest known version of the specified module, as returned by the system's module proxy.

func GetModFile

func GetModFile(g Getter, mod, version string) (*modfile.File, error)

GetModFile uses the provided getter instance to retrieve the go.mod file for the specified module by querying the system Go module proxy ($GOPROXY)

func GetModuleVersions

func GetModuleVersions(g Getter, mod string) ([]string, error)

GetModuleVersions uses the provided getter instance to retrieve a list of module versions for the specified module by querying the system Go module proxy ($GOPROXY)

Types

type Getter

type Getter interface {
	Get(url string) (*http.Response, error)
}

Getter defines a type, such as http.Client, that can perform an HTTP GET request and return the result.

This interface is defined so that consumers and tests can provide potentially customized implementations, but http.DefaultClient (or some other constructed http.Client instance) will likely be the most common implementation used.

type Proxy

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

Proxy wraps a Getter and a list of proxy URLs to provide the required module proxy operations

func New

func New(g Getter, urls ...string) Proxy

New returns a Proxy instance that will use g to execute HTTP requests against the module proxies in urls.

func NewFromEnv

func NewFromEnv(g Getter) Proxy

NewFromEnv returns a Proxy instance that will use g to execute HTTP requests against the module proxies configured in the system environment

func (Proxy) GetCurrentVersion

func (p Proxy) GetCurrentVersion(mod string, includePrerelease bool) (string, error)

GetCurrentVersion returns the highest known version of the specified module, as returned by list of module proxies configured on p.

func (Proxy) GetModFile

func (p Proxy) GetModFile(mod, version string) (*modfile.File, error)

GetModFile retrieves the go.mod file for the specified module by querying the list of module proxies configured on p.

func (Proxy) GetModuleVersions

func (p Proxy) GetModuleVersions(mod string) ([]string, error)

GetModuleVersions retrieve a list of module versions for the specified module by querying the list of module proxies configured on p.

Jump to

Keyboard shortcuts

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