Documentation ¶
Index ¶
- func GetAllModulePaths(workspaceRoot string) map[string]string
- func SetupModule(mod Module)
- func WriteModuleFile(modulePath string, deps []Dependency)
- type Dependency
- type GitModule
- func (m GitModule) CheckedOutVersions() []string
- func (m GitModule) CheckoutVersion(version string)
- func (m GitModule) Fetch() bool
- func (m GitModule) HasOrigin(url string) bool
- func (m GitModule) HasVersionCheckedOut(version string) bool
- func (m GitModule) IsDirty() bool
- func (m GitModule) Name() string
- func (m GitModule) Path() string
- type Module
- type TarModule
- func (m TarModule) CheckedOutVersions() []string
- func (m TarModule) CheckoutVersion(version string)
- func (m TarModule) Fetch() bool
- func (m TarModule) HasOrigin(url string) bool
- func (m TarModule) HasVersionCheckedOut(version string) bool
- func (m TarModule) IsDirty() bool
- func (m TarModule) Name() string
- func (m TarModule) Path() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllModulePaths ¶
GetAllModulePaths returns all the names and paths of all modules in the workspace.
func SetupModule ¶
func SetupModule(mod Module)
SetupModule runs the SETUP.go file in the root directory of `mod` (it if exists).
func WriteModuleFile ¶
func WriteModuleFile(modulePath string, deps []Dependency)
WriteModuleFile serializes and writes a Module's Dependencies to a MODULE file.
Types ¶
type Dependency ¶
Dependency represents a dependency one module has on another module.
func ReadModuleFile ¶
func ReadModuleFile(modulePath string) []Dependency
ReadModuleFile reads and parses module Dependencies from a MODULE file.
func (Dependency) ModuleName ¶
func (d Dependency) ModuleName() string
ModuleName parses the module name from the Dependency's URL.
type GitModule ¶
type GitModule struct {
// contains filtered or unexported fields
}
GitModule is a module backed by a git repository.
func (GitModule) CheckedOutVersions ¶
CheckedOutVersions returns all currently checked out versions. This includes the HEAD commit hash and all annotated tags that point to HEAD.
func (GitModule) CheckoutVersion ¶
CheckoutVersion changes the current module's version to `version`.
func (GitModule) Fetch ¶
Fetch fetches changes from the 'origin' remote and reports whether any updates have bee fetched.
func (GitModule) HasOrigin ¶
HasOrigin returns whether the underlying repository has a remote called origin that matches `url`.
func (GitModule) HasVersionCheckedOut ¶
HasVersionCheckedOut returns whether the current module's version matches `version`.
type Module ¶
type Module interface { Path() string Name() string IsDirty() bool HasOrigin(string) bool HasVersionCheckedOut(version string) bool CheckoutVersion(version string) Fetch() bool CheckedOutVersions() []string }
Module represents a checked-out module.
func CreateGitModule ¶
CreateGitModule creates a new GitModule in the given `modulePath` by cloning the repository from `url`.
func CreateTarModule ¶
CreateTarModule creates a new TarModule in the given `modulePath` by downloading and extracting the TAR archive reference by `url`. The origin of the module (i.e., the download url) is stored in a ".metadata" file inside the module directory.
func OpenModule ¶
OpenModule opens a module checked out on disk.
func OpenOrCreateModule ¶
OpenOrCreateModule tries to open the module in `modulePath`. If the `modulePath` directory does not yet exists, it tries to create a new module by cloning / downloading the module from `url`.
type TarModule ¶
type TarModule struct {
// contains filtered or unexported fields
}
TarModule is a module backed by a tar.gz archive. TarModules only have a single "master" version.
func (TarModule) CheckedOutVersions ¶
CheckedOutVersions returns all currently checked ot versions. For TarModules this is always the default version.
func (TarModule) CheckoutVersion ¶
CheckoutVersion changes the module's current version to `version` if possible. However, TarModules only have a single "master" version. Attempting to check out any other version results in an error.
func (TarModule) Fetch ¶
Fetch does nothing on TarModules and reports that no changes have been fetched.
func (TarModule) HasOrigin ¶
HasOrigin returns whether the origin of the module matches `url` by checking the ".metadata" file inside the module directory.
func (TarModule) HasVersionCheckedOut ¶
HasVersionCheckedOut returns whether the module's current version matched `version`. However, TarModules only have a single "master" version.