diff options
author | Jay Conrod <jayconrod@google.com> | 2020-10-22 18:20:00 -0400 |
---|---|---|
committer | Jay Conrod <jayconrod@google.com> | 2020-10-23 20:54:19 +0000 |
commit | d05e89a8fd35bb543df6a29faea81a85565db92f (patch) | |
tree | e13704ef425d9faf2339becffb1eec0e30e643db /src/cmd/go/internal/modload/buildlist.go | |
parent | c8c3c29daa74f2d3e1a26f2e289ad3d2b9ba20dd (diff) | |
download | go-d05e89a8fd35bb543df6a29faea81a85565db92f.tar.gz go-d05e89a8fd35bb543df6a29faea81a85565db92f.zip |
cmd/go: refactor modload.InitMod
InitMod is split into two functions. LoadModFile parses an existing
go.mod file and loads the build list (or checks vendor/modules.txt for
consistency in vendor mode). CreateModFile creates a new go.mod file,
possibly inferring the module path and importing a vendor
configuration file.
Some logic is moved from runInit to CreateModFile. init-specific logic
is removed from other functions.
This CL shouldn't cause substantial differences in behavior, though
some error messages are slightly different.
For #41712
Change-Id: Ia684945cfcf5beca30bbb81e7144fc246c4f27ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/264621
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/modload/buildlist.go')
-rw-r--r-- | src/cmd/go/internal/modload/buildlist.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modload/buildlist.go b/src/cmd/go/internal/modload/buildlist.go index 95a68637c6..76e5fe0173 100644 --- a/src/cmd/go/internal/modload/buildlist.go +++ b/src/cmd/go/internal/modload/buildlist.go @@ -37,7 +37,7 @@ var buildList []module.Version // // The caller must not modify the returned list. func LoadAllModules(ctx context.Context) []module.Version { - InitMod(ctx) + LoadModFile(ctx) ReloadBuildList() WriteGoMod() return buildList |