Documentation ¶
Index ¶
- Variables
- func DefaultModuleProxyBaseFolder() (baseFolder string, err error)
- type Info
- type ModuleProxyFolder
- func (f *ModuleProxyFolder) AddVersionToList(ver string) (err error)
- func (f *ModuleProxyFolder) ContainVersion(ver string) (hasVersion bool, err error)
- func (f *ModuleProxyFolder) CreateGoMod(ver string) (fp *os.File, err error)
- func (f *ModuleProxyFolder) CreateZip(ver string) (fp *os.File, err error)
- func (f *ModuleProxyFolder) ImportVersionsToList(versions []string) (err error)
- func (f *ModuleProxyFolder) LatestInfoFilePath() (p string, err error)
- func (f *ModuleProxyFolder) LoadVersionList() (vers []module.Version, err error)
- func (f *ModuleProxyFolder) SaveInfo(info Info) (err error)
- func (f *ModuleProxyFolder) SaveVersionList(vers []module.Version) (err error)
- func (f *ModuleProxyFolder) VersionListFilePath() (listFilePath string)
- func (f *ModuleProxyFolder) VersionedFilePath(ver, suffix string) (p string, err error)
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyVersion = errors.New("given version is empty")
ErrEmptyVersion indicate given version is empty.
Functions ¶
func DefaultModuleProxyBaseFolder ¶
DefaultModuleProxyBaseFolder fetch `GOPATH` from `go env` and generate default base folder path of module store (${GOPATH}/pkg/mod/cache/download).
Types ¶
type Info ¶
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.