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/list | |
parent | c8c3c29daa74f2d3e1a26f2e289ad3d2b9ba20dd (diff) | |
download | go-git-d05e89a8fd35bb543df6a29faea81a85565db92f.tar.gz |
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/list')
-rw-r--r-- | src/cmd/go/internal/list/list.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/internal/list/list.go b/src/cmd/go/internal/list/list.go index 9fd9d7446d..1c77e4d478 100644 --- a/src/cmd/go/internal/list/list.go +++ b/src/cmd/go/internal/list/list.go @@ -415,7 +415,7 @@ func runList(ctx context.Context, cmd *base.Command, args []string) { base.Fatalf("go list -m: not using modules") } - modload.InitMod(ctx) // Parses go.mod and sets cfg.BuildMod. + modload.LoadModFile(ctx) // Parses go.mod and sets cfg.BuildMod. if cfg.BuildMod == "vendor" { const actionDisabledFormat = "go list -m: can't %s using the vendor directory\n\t(Use -mod=mod or -mod=readonly to bypass.)" |