3// license that can be found in the LICENSE file.
4
5▶// Package modload provides module and package loading functionality.
6package modload
7
· · ·
40// TODO(#40775): See if these can be plumbed as explicit parameters.
41var (
42▶ // ExplicitWriteGoMod prevents LoadPackages, ListModules, and other functions
43 // from updating go.mod and go.sum or reporting errors when updates are
44 // needed. A package should set this if it would cause go.mod to be written
· · ·
58// NewForModroot creates a new module loader in single-module mode for the module at
59// the given modroot..
60▶func NewForModroot(ctx context.Context, modroot string) *Loader {
61 ld := NewLoader()
62 ld.modRoots = []string{modroot}
· · ·
66
67// NewForWorkspace creates a new loader for workspace mode from the given module mode loader ld,
68▶// applying ld's updated requirements to the main module to the corresponding module in the workspace.
69func (ld *Loader) NewForWorkspace(ctx context.Context) (*Loader, error) {
70 // Find the identity of the main module that will be updated before we reset modload state.
· · ·
69▶func (ld *Loader) NewForWorkspace(ctx context.Context) (*Loader, error) {
70 // Find the identity of the main module that will be updated before we reset modload state.
71 mm := ld.MainModules.mustGetSingleMainModule(ld)
+ 211 more matches in this file