module

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllModules added in v1.2.8

func GetAllModules(workspaceRoot string) map[string]Module

GetAllModules return all the names and modules in the workspace

func SetupModule

func SetupModule(modulePath string)

SetupModule runs the SETUP.go file in the root directory of `mod` (it if exists).

func WriteModuleFile

func WriteModuleFile(modulePath string, moduleFile ModuleFile)

WriteModuleFile serializes and writes a Module's Dependencies to a MODULE file.

Types

type Dependency

type Dependency struct {
	URL     string
	Version string
	Hash    string
	Type    string
}

type GitMirror added in v1.3.2

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

GitMirror is a bare repository that backs a GitModule

type GitModule

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

GitModule is a module backed by a git repository.

func (GitModule) Checkout added in v1.0.0

func (m GitModule) Checkout(ref string)

Checkout changes the current module's version to `ref`.

func (GitModule) Fetch

func (m GitModule) Fetch() bool

Fetch fetches changes from the default remote and reports whether any updates have been fetched.

func (GitModule) GetCommitAuthorName added in v1.3.13

func (m GitModule) GetCommitAuthorName(revision string) (string, error)

func (GitModule) GetCommitTitle added in v1.3.13

func (m GitModule) GetCommitTitle(revision string) (string, error)

func (GitModule) GetCommitsBetweenRefs added in v1.3.13

func (m GitModule) GetCommitsBetweenRefs(base, head string) ([]string, error)

func (GitModule) GetMergeBase added in v1.3.13

func (m GitModule) GetMergeBase(revA, revB string) (string, error)

GetMergeBase returns the best common ancestor that could be used for a merge between the two given references.

func (GitModule) Head added in v1.0.0

func (m GitModule) Head() string

Head returns the commit hash of the HEAD of the underlying git repository.

func (GitModule) IsAncestor added in v1.3.0

func (m GitModule) IsAncestor(ancestor, rev string) bool

IsAncestor returns whether ancestor is an ancestor of rev in the commit tree.

func (GitModule) IsDirty

func (m GitModule) IsDirty() bool

IsDirty returns whether the underlying repository has any uncommited changes.

func (GitModule) Mirror added in v1.3.2

func (m GitModule) Mirror() *GitMirror

Mirror returns the path of the mirror

func (GitModule) Name

func (m GitModule) Name() string

func (GitModule) RevParse added in v1.0.0

func (m GitModule) RevParse(ref string) string

RevParse returns the commit hash for the commit referenced by `ref`.

func (GitModule) RootPath added in v1.2.8

func (m GitModule) RootPath() string

func (GitModule) Type added in v1.3.13

func (m GitModule) Type() ModuleType

func (GitModule) URL added in v1.0.0

func (m GitModule) URL() string

URL returns the url of the underlying git repository.

type GoFile added in v1.2.8

type GoFile struct {
	// Absolute path to file
	SourcePath string
	// Relatve path from go root
	CopyPath string
}

func ListBuildFiles added in v1.2.8

func ListBuildFiles(module Module) []GoFile

func ListRules added in v1.2.8

func ListRules(module Module) []GoFile

type GoModule added in v1.2.8

type GoModule struct {
	// Module name
	Name string
	// Used modules
	Deps []string
}

func ListGoModules added in v1.2.8

func ListGoModules(module Module) []GoModule

type Module

type Module interface {
	Name() string
	URL() string

	Head() string
	RevParse(rev string) string
	IsDirty() bool
	IsAncestor(ancestor, rev string) bool

	Fetch() bool
	Checkout(hash string)

	RootPath() string
	Type() ModuleType
}

Module represents a checked-out module.

func CreateGitModule

func CreateGitModule(modulePath, url string) (Module, error)

createGitModule creates a new GitModule in the given `modulePath` by cloning the repository from `url`.

func OpenModule

func OpenModule(modulePath string) Module

OpenModule opens a module checked out on disk.

func OpenModuleByName added in v1.3.13

func OpenModuleByName(moduleName string) Module

OpenModuleByName opens a module checked out on disk.

func OpenOrCreateModule

func OpenOrCreateModule(modulePath string, url string, moduleTypeString string, expectedHash string) Module

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 ModuleFile added in v1.0.0

type ModuleFile struct {
	Version      uint
	Layout       string
	Dependencies map[string]Dependency
	Flags        map[string]string
	PersistFlags *bool `yaml:"persist-flags,omitempty"`
}

func ReadModuleFile

func ReadModuleFile(modulePath string) ModuleFile

ReadModuleFile reads and parses module Dependencies from a MODULE file.

type ModuleType added in v1.3.9

type ModuleType uint
const (
	GitModuleType ModuleType = iota
	TarGzModuleType
)

func DetermineModuleType added in v1.3.16

func DetermineModuleType(url, moduleTypeString string) ModuleType

func ParseModuleTypeString added in v1.3.13

func ParseModuleTypeString(str string) (ModuleType, bool)

func (ModuleType) String added in v1.3.13

func (t ModuleType) String() string

type TarMirror added in v1.3.2

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

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) Checkout added in v1.0.0

func (m TarModule) Checkout(hash string)

Checkout changes the module's current version to `ref`. TarModules only have a single version. Attempting to check out any other version results in an error.

func (TarModule) Fetch

func (m TarModule) Fetch() bool

Fetch does nothing on TarModules and reports that no changes have been fetched.

func (TarModule) Head added in v1.0.0

func (m TarModule) Head() string

Head returns the default version for all TarModules.

func (TarModule) IsAncestor added in v1.3.0

func (m TarModule) IsAncestor(ancestor, rev string) bool

func (TarModule) IsDirty

func (m TarModule) IsDirty() bool

IsDirty returns whether the module has any uncommited changes. TarModules never have any uncommited changes by definition.

func (TarModule) Name

func (m TarModule) Name() string

func (TarModule) RevParse added in v1.0.0

func (m TarModule) RevParse(rev string) string

RevParse returns the default version for all TarModules.

func (TarModule) RootPath added in v1.2.8

func (m TarModule) RootPath() string

func (TarModule) Type added in v1.3.13

func (m TarModule) Type() ModuleType

func (TarModule) URL added in v1.0.0

func (m TarModule) URL() string

URL returns the url of the underlying tar archive.

Jump to

Keyboard shortcuts

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