module

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownPathType = errors.New("unknown path type")
	ErrInvalidPath     = errors.New("invalid path")
	ErrInvalidPathType = errors.New("invalid path type")
	ErrUnknownVersion  = errors.New("unknown version")
)

Defined a common set of error types for Module Path

Functions

This section is empty.

Types

type Info

type Info struct {
	Version string
	Time    time.Time
}

Info is the standard return value, which corresponds to *.info in go cache

type List

type List struct {
	Path     string    `json:"Path"`
	Version  string    `json:"Version"`
	Versions Versions  `json:",omitempty"`
	Time     time.Time `json:"time"`
	Dir      string    `json:"Dir"`
	GoMod    string    `json:"GoMod"`
}

List is the standard return value, which corresponds to the go list -json command.

func (*List) GetVersions

func (s *List) GetVersions() Versions

GetVersions is used to get all valid versions of package

type Module

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

Module defines the structure of package module

func NewModule

func NewModule(addr, version string) *Module

NewModule is used to init a module

func (*Module) GetAddr

func (m *Module) GetAddr() string

GetAddr is used to get the module address

func (*Module) GetAddrWithVersion

func (m *Module) GetAddrWithVersion() string

GetAddrWithVersion is used to get the module name with version

func (*Module) GetDomain

func (m *Module) GetDomain() string

GetDomain is used to get the domain of remote repo address

func (*Module) GetInfoAddr

func (m *Module) GetInfoAddr(base string, isUpstream bool) (string, error)

GetInfoAddr is used to get info address

func (*Module) GetLatestAddr

func (m *Module) GetLatestAddr(base string, isUpstream bool) (string, error)

GetLatestAddr is used to get latest address

func (*Module) GetListAddr

func (m *Module) GetListAddr(base string, isUpstream bool) (string, error)

GetListAddr is used to get list address

func (*Module) GetModAddr

func (m *Module) GetModAddr(base string, isUpstream bool) (string, error)

GetModAddr is used to get mod address

func (*Module) GetStorageInfo

func (m *Module) GetStorageInfo(base string) (io.ReadCloser, error)

GetStorageInfo is used to get the info of module from the local storage

func (*Module) GetStorageMod

func (m *Module) GetStorageMod(base string) (io.ReadCloser, error)

GetStorageMod is used to get the mod of module from the local storage

func (*Module) GetStorageZip

func (m *Module) GetStorageZip(base string) (io.ReadCloser, error)

GetStorageZip is used to get the zip file of module from the local storage

func (*Module) GetVersion

func (m *Module) GetVersion() string

GetVersion is used to get the module version

func (*Module) GetZipAddr

func (m *Module) GetZipAddr(base string, isUpstream bool) (string, error)

GetZipAddr is used to get zip address

type Path

type Path struct {
	Module
	// contains filtered or unexported fields
}

Path is used to parse the request path and generate the module info.

func NewPath

func NewPath(raw string) (*Path, error)

NewPath is used to create a new path instance

func (*Path) GetModAddr

func (m *Path) GetModAddr() string

GetModAddr is used to get the module address of specified module path

func (*Path) GetModVersion

func (m *Path) GetModVersion() string

GetModVersion is used to get the module version of specified module path

func (*Path) GetType

func (m *Path) GetType() PathType

GetType is used to get the path type of specified module path

type PathType

type PathType uint8

PathType defines the path type

const (
	TypePathUnknown PathType = iota
	TypePathList
	TypePathLatest
	TypePathInfo
	TypePathMod
	TypePathZip
)

Defined a common set of module path types for Module Path

type Versions

type Versions []string

Versions is the slice of version

func (Versions) String

func (v Versions) String() string

Jump to

Keyboard shortcuts

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