modproxyfolder

package
v0.0.0-...-6e23cf3 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyVersion = errors.New("given version is empty")

ErrEmptyVersion indicate given version is empty.

Functions

func DefaultModuleProxyBaseFolder

func DefaultModuleProxyBaseFolder() (baseFolder string, err error)

DefaultModuleProxyBaseFolder fetch `GOPATH` from `go env` and generate default base folder path of module store (${GOPATH}/pkg/mod/cache/download).

Types

type Info

type Info struct {
	Version string    // version string
	Time    time.Time // commit time
}

Info is the structure of module information for module proxy protocol. Ref: https://golang.org/cmd/go/#hdr-Module_proxy_protocol

type ModuleProxyFolder

type ModuleProxyFolder struct {
	FolderPath string
	ModulePath string
	// contains filtered or unexported fields
}

ModuleProxyFolder represent folder of a module.

func NewModuleProxyFolder

func NewModuleProxyFolder(baseFolder string, modulePath string) (modProxyFolder *ModuleProxyFolder, err error)

NewModuleProxyFolder create an instance of ModuleProxyFolder. If baseFolder is empty, default path based on GOPATH (${GOPATH}/pkg/mod/cache/download) will be generated.

func (*ModuleProxyFolder) AddVersionToList

func (f *ModuleProxyFolder) AddVersionToList(ver string) (err error)

AddVersionToList add given version into list file.

func (*ModuleProxyFolder) ContainVersion

func (f *ModuleProxyFolder) ContainVersion(ver string) (hasVersion bool, err error)

ContainVersion check if given version is contain in folder.

func (*ModuleProxyFolder) CreateGoMod

func (f *ModuleProxyFolder) CreateGoMod(ver string) (fp *os.File, err error)

CreateGoMod open the mod file for write.

func (*ModuleProxyFolder) CreateZip

func (f *ModuleProxyFolder) CreateZip(ver string) (fp *os.File, err error)

CreateZip open module zip file for write.

func (*ModuleProxyFolder) ImportVersionsToList

func (f *ModuleProxyFolder) ImportVersionsToList(versions []string) (err error)

ImportVersionsToList feed version strings into list file

func (*ModuleProxyFolder) LatestInfoFilePath

func (f *ModuleProxyFolder) LatestInfoFilePath() (p string, err error)

LatestInfoFilePath get the info file path of latest version.

func (*ModuleProxyFolder) LoadVersionList

func (f *ModuleProxyFolder) LoadVersionList() (vers []module.Version, err error)

LoadVersionList fetch versions from list file.

func (*ModuleProxyFolder) SaveInfo

func (f *ModuleProxyFolder) SaveInfo(info Info) (err error)

SaveInfo store the given info.

func (*ModuleProxyFolder) SaveVersionList

func (f *ModuleProxyFolder) SaveVersionList(vers []module.Version) (err error)

SaveVersionList write given versions into list file.

func (*ModuleProxyFolder) VersionListFilePath

func (f *ModuleProxyFolder) VersionListFilePath() (listFilePath string)

VersionListFilePath return the file path of version list file.

func (*ModuleProxyFolder) VersionedFilePath

func (f *ModuleProxyFolder) VersionedFilePath(ver, suffix string) (p string, err error)

VersionedFilePath build file path with given version and file suffix. This function will not prepare folders if not existed.

Jump to

Keyboard shortcuts

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