Documentation ¶
Index ¶
- func GetGitLatestCommitId(ctx context.Context, log logger.Logger, repo string) (string, error)
- func GetGoPkgExecName(pkgPath string) string
- func GetPluginPath(path string, version string) (string, error)
- func InstallPluginUsingGo(ctx context.Context, log logger.Logger, storageDir string, path string, ...) (string, error)
- func IsPluginInstalled(ctx context.Context, storageDir string, path string, version string) (bool, string, error)
- func IsProtocInstalled(ctx context.Context, storageDir string, version string) (bool, string, error)
- func ListGitTags(ctx context.Context, log logger.Logger, repo string) ([]string, error)
- func ListGoPackageVersions(ctx context.Context, log logger.Logger, path string) ([]string, error)
- func ListsGoPackageVersionsAmbiguously(ctx context.Context, log logger.Logger, pkg string) ([]string, error)
- func PathForGitRepos(storageDir string, commitId string) string
- func PathForGitReposCode(storageDir string, uri string, commitId string) (string, error)
- func PathForInclude(storageDir string) string
- func PathForPlugin(storageDir string, path string, version string) (string, error)
- func PathForPluginDir(storageDir string, path string, version string) (string, error)
- func PathForProtoc(storageDir string, version string) string
- type BasicPluginManager
- func (b *BasicPluginManager) GetGitRepoLatestVersion(ctx context.Context, url string) (string, error)
- func (b *BasicPluginManager) GetPathForPlugin(ctx context.Context, path string, version string) (local string, err error)
- func (b *BasicPluginManager) GetPathForProtoc(ctx context.Context, version string) (string, error)
- func (b *BasicPluginManager) GetPluginLatestVersion(ctx context.Context, path string) (string, error)
- func (b *BasicPluginManager) GetProtocLatestVersion(ctx context.Context) (string, error)
- func (b *BasicPluginManager) GitRepoPath(ctx context.Context, commitId string) (string, error)
- func (b *BasicPluginManager) IncludePath(ctx context.Context) (string, error)
- func (b *BasicPluginManager) InstallGitRepo(ctx context.Context, uri string, commitId string) (string, error)
- func (b *BasicPluginManager) InstallPlugin(ctx context.Context, path string, version string) (local string, err error)
- func (b *BasicPluginManager) InstallProtoc(ctx context.Context, version string) (string, error)
- func (b *BasicPluginManager) IsGitRepoInstalled(ctx context.Context, uri string, commitId string) (bool, string, error)
- func (b *BasicPluginManager) IsPluginInstalled(ctx context.Context, path string, version string) (bool, string, error)
- func (b *BasicPluginManager) IsProtocInstalled(ctx context.Context, version string) (bool, string, error)
- func (b *BasicPluginManager) ListPluginVersions(ctx context.Context, path string) ([]string, error)
- func (b *BasicPluginManager) ListProtocVersions(ctx context.Context) ([]string, error)
- type Config
- type ErrGitList
- type ErrGoInstall
- type ErrGoList
- type ErrHTTPDownload
- type GithubArchive
- type Module
- type ModuleError
- type PluginManager
- type ProtocRelease
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGitLatestCommitId ¶
GetGitLatestCommitId is used to get the latest commit id
func GetGoPkgExecName ¶
GetGoPkgExecName is used to parse binary name from pkg uri `src\cmd\go\internal\load\pkg.go:1595`
func GetPluginPath ¶
GetPluginPath is used to get the plugin path
func InstallPluginUsingGo ¶
func InstallPluginUsingGo(ctx context.Context, log logger.Logger, storageDir string, path string, version string) (string, error)
InstallPluginUsingGo is used to install plugin using golang
func IsPluginInstalled ¶
func IsPluginInstalled(ctx context.Context, storageDir string, path string, version string) (bool, string, error)
IsPluginInstalled is used to check whether a plugin is installed
func IsProtocInstalled ¶
func IsProtocInstalled(ctx context.Context, storageDir string, version string) (bool, string, error)
IsProtocInstalled is used to check whether the protoc version is installed
func ListGitTags ¶
ListGitTags is used to list the git tags of specified repository
func ListGoPackageVersions ¶
ListGoPackageVersions is list go package versions
func ListsGoPackageVersionsAmbiguously ¶
func ListsGoPackageVersionsAmbiguously(ctx context.Context, log logger.Logger, pkg string) ([]string, error)
ListsGoPackageVersionsAmbiguously is used to list go package versions ambiguously
func PathForGitRepos ¶ added in v0.3.0
PathForGitRepos is used to get the git repo local path
func PathForGitReposCode ¶ added in v0.3.0
PathForGitReposCode returns the code path for git repos
func PathForInclude ¶
PathForInclude is used to get the local directory of include files
func PathForPlugin ¶
PathForPlugin is used to get the binary path of plugin Path: e.g "google.golang.org/protobuf/cmd/protoc-gen-go"
func PathForPluginDir ¶
PathForPluginDir is used to get the local directory where the specified version plug-in should be stored
func PathForProtoc ¶
PathForProtoc is used to get the local binary location where the specified version protoc should be stored
Types ¶
type BasicPluginManager ¶
BasicPluginManager is the basic implement of PluginManager
func NewBasicPluginManager ¶
func NewBasicPluginManager(storageDir string, log logger.Logger) (*BasicPluginManager, error)
NewBasicPluginManager is used to create basic PluginManager
func (*BasicPluginManager) GetGitRepoLatestVersion ¶ added in v0.3.0
func (b *BasicPluginManager) GetGitRepoLatestVersion(ctx context.Context, url string) (string, error)
GetGitRepoLatestVersion is used to get the latest version of google apis
func (*BasicPluginManager) GetPathForPlugin ¶ added in v0.4.0
func (b *BasicPluginManager) GetPathForPlugin(ctx context.Context, path string, version string) (local string, err error)
GetPathForPlugin is used to get path for plugin executable file
func (*BasicPluginManager) GetPathForProtoc ¶ added in v0.4.0
GetPathForProtoc is used to get the path for protoc
func (*BasicPluginManager) GetPluginLatestVersion ¶
func (b *BasicPluginManager) GetPluginLatestVersion(ctx context.Context, path string) (string, error)
GetPluginLatestVersion is used to get the latest version of plugin
func (*BasicPluginManager) GetProtocLatestVersion ¶
func (b *BasicPluginManager) GetProtocLatestVersion(ctx context.Context) (string, error)
GetProtocLatestVersion is used to get the latest version of protoc
func (*BasicPluginManager) GitRepoPath ¶ added in v0.3.0
GitRepoPath returns the googleapis path
func (*BasicPluginManager) IncludePath ¶
func (b *BasicPluginManager) IncludePath(ctx context.Context) (string, error)
IncludePath returns the default include path
func (*BasicPluginManager) InstallGitRepo ¶ added in v0.3.0
func (b *BasicPluginManager) InstallGitRepo(ctx context.Context, uri string, commitId string) (string, error)
InstallGitRepo is used to install google apis
func (*BasicPluginManager) InstallPlugin ¶
func (b *BasicPluginManager) InstallPlugin(ctx context.Context, path string, version string) (local string, err error)
InstallPlugin is used to install plugin
func (*BasicPluginManager) InstallProtoc ¶
InstallProtoc is used to install protoc of specified version
func (*BasicPluginManager) IsGitRepoInstalled ¶ added in v0.3.0
func (b *BasicPluginManager) IsGitRepoInstalled(ctx context.Context, uri string, commitId string) (bool, string, error)
IsGitRepoInstalled is used to check whether the protoc is installed
func (*BasicPluginManager) IsPluginInstalled ¶
func (b *BasicPluginManager) IsPluginInstalled(ctx context.Context, path string, version string) (bool, string, error)
IsPluginInstalled is used to check whether the plugin is installed
func (*BasicPluginManager) IsProtocInstalled ¶
func (b *BasicPluginManager) IsProtocInstalled(ctx context.Context, version string) (bool, string, error)
IsProtocInstalled is used to check whether the protoc is installed
func (*BasicPluginManager) ListPluginVersions ¶
ListPluginVersions is used to list the versions of plugin
func (*BasicPluginManager) ListProtocVersions ¶
func (b *BasicPluginManager) ListProtocVersions(ctx context.Context) ([]string, error)
ListProtocVersions is used to list protoc version
type Config ¶
type Config struct {
StorageDir string `json:"storage"`
}
Config defines the config of PluginManager
type ErrGitList ¶
type ErrGitList struct {
*command.ErrCommandExec
}
ErrGitList defines the git list error
type ErrGoInstall ¶
type ErrGoInstall struct {
*command.ErrCommandExec
}
ErrGoInstall defines the go install error
type ErrGoList ¶
type ErrGoList struct {
*command.ErrCommandExec
}
ErrGoList defines the go list error
type ErrHTTPDownload ¶
ErrHTTPDownload defines the download error
func (*ErrHTTPDownload) Error ¶
func (err *ErrHTTPDownload) Error() string
Error implements the error interface
type GithubArchive ¶ added in v0.3.0
type GithubArchive struct {
// contains filtered or unexported fields
}
GithubArchive is github archive
func GetGithubArchive ¶ added in v0.3.0
GetGithubArchive is used to download github archive
func (*GithubArchive) Clear ¶ added in v0.3.0
func (c *GithubArchive) Clear() error
Clear is used to clear the workspace
func (*GithubArchive) GetLocalDir ¶ added in v0.3.0
func (c *GithubArchive) GetLocalDir() string
GetLocalDir is used to get local dir of archive
type Module ¶
type Module struct { Path string // module path Version string // module version Versions []string // available module versions (with -versions) Replace *Module // replaced by this module Time *time.Time // time version was created Update *Module // available update, if any (with -u) Main bool // is this the main module? Indirect bool // is this module only an indirect dependency of main module? Dir string // directory holding files for this module, if any GoMod string // path to go.mod file used when loading this module, if any GoVersion string // go version used in module Retracted string // retraction information, if any (with -retracted or -u) Error *ModuleError // error loading module }
Module defines the model of go list data
type ModuleError ¶
type ModuleError struct {
Err string // the error itself
}
ModuleError defines the module error
type PluginManager ¶
type PluginManager interface { // GetPluginLatestVersion is used to get the latest version of plugin GetPluginLatestVersion(ctx context.Context, path string) (string, error) // ListPluginVersions is used to list the versions of plugin ListPluginVersions(ctx context.Context, path string) ([]string, error) // IsPluginInstalled is used to check whether the plugin is installed IsPluginInstalled(ctx context.Context, path string, version string) (bool, string, error) // InstallPlugin is used to install plugin InstallPlugin(ctx context.Context, path string, version string) (local string, err error) // GetPathForPlugin is used to get path for plugin executable file GetPathForPlugin(ctx context.Context, path string, version string) (local string, err error) // GetGitRepoLatestVersion is used to get the latest version of google apis GetGitRepoLatestVersion(ctx context.Context, uri string) (string, error) // InstallGitRepo is used to install google apis InstallGitRepo(ctx context.Context, uri string, commitId string) (local string, err error) // IsGitRepoInstalled is used to check whether the protoc is installed IsGitRepoInstalled(ctx context.Context, uri string, commitId string) (bool, string, error) // GitRepoPath returns the git repo path GitRepoPath(ctx context.Context, commitId string) (string, error) // GetProtocLatestVersion is used to get the latest version of protoc GetProtocLatestVersion(ctx context.Context) (string, error) // ListProtocVersions is used to list protoc version ListProtocVersions(ctx context.Context) ([]string, error) // IsProtocInstalled is used to check whether the protoc is installed IsProtocInstalled(ctx context.Context, version string) (bool, string, error) // InstallProtoc is used to install protoc of specified version InstallProtoc(ctx context.Context, version string) (local string, err error) // IncludePath returns the default include path IncludePath(ctx context.Context) (string, error) // GetPathForProtoc is used to get the path of protoc GetPathForProtoc(ctx context.Context, version string) (string, error) }
PluginManager is used to manage plugins
func NewPluginManager ¶
func NewPluginManager(cfg *Config, log logger.Logger) (PluginManager, error)
NewPluginManager is used to create PluginManager
type ProtocRelease ¶
type ProtocRelease struct {
// contains filtered or unexported fields
}
ProtocRelease defines the release of protoc
func GetProtocRelease ¶
func GetProtocRelease(ctx context.Context, version string) (*ProtocRelease, error)
GetProtocRelease is used to download protoc release
func (*ProtocRelease) Clear ¶
func (p *ProtocRelease) Clear() error
Clear is used to clear the workspace
func (*ProtocRelease) GetIncludePath ¶
func (p *ProtocRelease) GetIncludePath() string
GetIncludePath is used to get the include path
func (*ProtocRelease) GetProtocPath ¶
func (p *ProtocRelease) GetProtocPath() string
GetProtocPath is used to get the protoc path