aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modload/buildlist.go
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2020-10-22 18:20:00 -0400
committerJay Conrod <jayconrod@google.com>2020-10-23 20:54:19 +0000
commitd05e89a8fd35bb543df6a29faea81a85565db92f (patch)
treee13704ef425d9faf2339becffb1eec0e30e643db /src/cmd/go/internal/modload/buildlist.go
parentc8c3c29daa74f2d3e1a26f2e289ad3d2b9ba20dd (diff)
downloadgo-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.go2
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