# Functions
AllowMissingModuleImports allows import paths to be resolved to modules when there is no module root.
No description provided by the author
CheckAllowed returns an error equivalent to ErrDisallowed if m is excluded by the main module's go.mod or retracted by its author.
CheckDeprecation returns a deprecation message from the go.mod file of the latest version of the given module.
CheckExclusions returns an error equivalent to ErrDisallowed if module m is excluded by the main module's go.mod file.
No description provided by the author
CheckRetractions returns an error if module m has been retracted by its author.
CreateModFile initializes a new module by creating a go.mod file.
EditBuildList edits the global build list by first adding every module in add to the existing build list, then adjusting versions (and adding or removing requirements as needed) until every module in mustSelect is selected at the given version.
Enabled reports whether modules are (or must be) enabled.
EnterModule resets MainModules and requirements to refer to just this one module.
FindGoMod returns the name of the go.mod file for this command, or the empty string if there isn't one.
FindGoWork returns the name of the go.work file for this command, or the empty string if there isn't one.
HasModRoot reports whether a main module is present.
ImportFromFiles adds modules to the build list as needed to satisfy the imports in the named Go source files.
Init determines whether module mode is enabled, locates the root of the current module (if any), sets environment variables for Git subprocesses, and configures the cfg, codehost, load, modfetch, and search packages for use with modules.
InitWorkfile initializes the workFilePath variable for commands that operate in workspace mode.
IsRevisionQuery returns true if vers is a version query that may refer to a particular version or revision in a repository like "v1.0.0", "master", or "0123abcd".
ListModules returns a description of the modules matching args, if known, along with any error preventing additional matches from being identified.
LoadModFile sets Target and, if there is a main module, parses the initial build list from its go.mod file.
LoadModGraph loads and returns the graph of module dependencies of the main module, without loading any packages.
LoadPackages identifies the set of packages matching the given patterns and loads the packages in the import graph rooted at that set.
Lookup returns the source directory, import path, and any loading error for the package at path as imported from the package in parentDir.
MatchInModule identifies the packages matching the given pattern within the given module version, which does not need to be in the build list or module requirement graph.
ModFile returns the parsed go.mod file.
ModFilePath returns the path that would be used for the go.mod file, if in module mode.
No description provided by the author
No description provided by the author
No description provided by the author
MustHaveModRoot checks that a main module or main modules are present, and calls base.Fatalf if there are no main modules.
OverrideRoots edits the global requirement roots by replacing the specific module versions.
PackageModRoot returns the module root directory for the module that provides a given package.
PackageModule returns the module providing the package named by the import path.
PackageModuleInfo returns information about the module that provides a given package.
Query looks up a revision of a given module given a version query string.
QueryPackages is like QueryPattern, but requires that the pattern match at least one package and omits the non-package result (if any).
QueryPattern looks up the module(s) containing at least one package matching the given pattern at the given version.
ReadModFile reads and parses the mod file at gomod.
ReadWorkFile reads and parses the go.work file at the given path.
Replacement returns the replacement for mod, if any.
Reset clears all the initialized, cached state about the use of modules, so that we can start over.
ShortMessage returns a string from go.mod (for example, a retraction rationale or deprecation message) that is safe to print in a terminal.
ToDirectoryPath adds a prefix if necessary so that path in unambiguously an absolute path or a relative path starting with a '.' or '..' path component.
UpdateGoModFromReqs returns a modified go.mod file using the current requirements.
UpdateWorkFile updates comments on directory directives in the go.work file to include the associated module path.
UpdateWorkGoVersion updates the go line in wf to be at least goVers, reporting whether it changed the file.
No description provided by the author
Why returns the "go mod why" output stanza for the given package, without the leading # comment.
WhyDepth returns the number of steps in the Why listing.
WillBeEnabled checks whether modules should be enabled but does not initialize modules by installing hooks.
WorkFilePath returns the absolute path of the go.work file, or "" if not in workspace mode.
WriteGoMod writes the current build list back to go.mod.
WriteWorkFile cleans and writes out the go.work file to the given path.
# Constants
AutoRoot is the default for most commands.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NeedRoot is used for commands that must run in module mode and don't make sense without a main module.
NoRoot is used for commands that run in module mode and ignore any go.mod file the current directory or in parent directories.
# Variables
ErrDisallowed is returned by version predicates passed to Query and similar functions to indicate that a version should not be considered.
No description provided by the author
ExplicitWriteGoMod prevents LoadPackages, ListModules, and other functions from updating go.mod and go.sum or reporting errors when updates are needed.
ForceUseModules may be set to force modules to be enabled when GO111MODULE=auto or to report an error when GO111MODULE=off.
No description provided by the author
No description provided by the author
No description provided by the author
RootMode determines whether a module root is needed.
# Structs
An AmbiguousImportError indicates an import of a package found in multiple modules in the build list, or found in both the main module and its vendor directory.
A Conflict is a path of requirements starting at a root or proposed root in the requirement graph, explaining why that root either causes a module passed in the mustSelect list to EditBuildList to be unattainable, or introduces an unresolvable error in loading the requirement graph.
A ConstraintError describes inconsistent constraints in EditBuildList.
A DirectImportFromImplicitDependencyError indicates a package directly imported by a package or test in the main module that is satisfied by a dependency that is not explicit in the main module's go.mod file.
No description provided by the author
ImportMissingSumError is reported in readonly mode when we need to check if a module contains a package, but we don't have a sum for its .zip file.
No description provided by the author
A ModuleGraph represents the complete graph of module dependencies of a main module.
No description provided by the author
A NoMatchingVersionError indicates that Query found a module at the requested path, but not at any versions satisfying the query string and allow-function.
A NoPatchBaseError indicates that Query was called with the query "patch" but with a current version of "" or "none".
A PackageNotInModuleError indicates that QueryPattern found a candidate module at the requested version, but that module did not contain any packages matching the requested pattern.
PackageOpts control the behavior of the LoadPackages function.
A QueryMatchesMainModulesError indicates that a query requests a version of the main module that cannot be satisfied.
A QueryMatchesPackagesInMainModuleError indicates that a query cannot be satisfied because it matches one or more packages found in the main module.
No description provided by the author
A QueryUpgradesAllError indicates that a query requests an upgrade on the all pattern.
A Requirements represents a logically-immutable set of root module requirements.
A WildcardInFirstElementError indicates that a pattern passed to QueryPattern had a wildcard in its first path element, and therefore had no pattern-prefix modules to search in.
WriteOpts control the behavior of WriteGoMod.
# Type aliases
AllowedFunc is used by Query and other functions to filter out unsuitable versions, for example, those listed in exclude directives in the main module's go.mod file.
No description provided by the author
No description provided by the author