module

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpGet

func HttpGet(url *url.URL) (io.ReadCloser, error)

Retrieve a file using an HTTP GET request

func NewClient

func NewClient(url *url.URL) *sumdb.Client

Returns a new SubDbClient for the given url

Types

type BuildList

type BuildList struct {
	sync.Mutex
	// contains filtered or unexported fields
}

A list of modules required for a given build

func NewBuildList

func NewBuildList() *BuildList

func (*BuildList) All

func (b *BuildList) All() []Module

Returns a list of all modules in the BuildList

func (*BuildList) Visit

func (b *BuildList) Visit(m Module) bool

Add a module to the build list if it has not been seen before

returns true for new modules, returns false if the module has already been visited

type Module

type Module struct {
	Path    string
	Version string
}

func New

func New(mod module.Version) Module

func Parse

func Parse(fullName string) (Module, error)

Read a module path and optional version from a string

func (Module) CanonicalizePath

func (m Module) CanonicalizePath(proxyUrl *url.URL) (string, error)

Download the module file for a user-provided path and version and convert the path to the canonical form

func (Module) Download

func (m Module) Download(proxyUrl *url.URL, outdir string, db *sumdb.Client) error

Download and validate the info, mod, and zip files from a module proxy

func (Module) EscapedPath

func (m Module) EscapedPath() string

Escape special characters in module path strings

func (Module) EscapedVersion

func (m Module) EscapedVersion() string

Escape special characters in module version strings

func (Module) InfoFile

func (m Module) InfoFile() ModuleFile

Create a new ModuleFile that represents a proxy's .info file

func (Module) LatestVersion

func (m Module) LatestVersion(proxyUrl *url.URL) (string, error)

Get the most recent version of a module in semver order

func (Module) ModuleFile

func (m Module) ModuleFile() ModuleFile

Create a new ModuleFile that represents a proxy's .mod file

func (Module) String

func (m Module) String() string

Get the string representation of a module

func (Module) Versions

func (m Module) Versions(proxyUrl *url.URL) ([]string, error)

Get a list of available versions for a module from a proxy

func (Module) ZipFile

func (m Module) ZipFile() ModuleFile

Create a new ModuleFile that represents a proxy's .zip file

type ModuleFile

type ModuleFile struct {
	Mod       Module
	Type      ModuleFileType
	FileName  string
	FilePath  string
	ProxyPath string
}

func NewModuleFile

func NewModuleFile(m Module, fileType ModuleFileType) ModuleFile

Create a new ModuleFile of the provided type for a Module

func (ModuleFile) Download

func (f ModuleFile) Download(proxyUrl *url.URL, outdir string, db *sumdb.Client) error

Download a ModuleFile from a proxy

type ModuleFileType

type ModuleFileType string
const (
	ModFileTypeInfo   ModuleFileType = ".info"
	ModFileTypeModule ModuleFileType = ".mod"
	ModFileTypeZip    ModuleFileType = ".zip"
)

Types of files used by go proxies

Jump to

Keyboard shortcuts

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