mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/go: reorder parameters so that context is first
This change simply reorders parameters so that the context.Context is the first, as per standard practice. This commit is part of the overall effort to eliminate global modloader state. Change-Id: I22d366fb2d2457f44d668409da3fe76fb87180cc Reviewed-on: https://go-review.googlesource.com/c/go/+/714780 Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
f527994c61
commit
f619b4a00d
2 changed files with 4 additions and 4 deletions
|
|
@ -62,6 +62,6 @@ func runInit(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
wf := new(modfile.WorkFile)
|
wf := new(modfile.WorkFile)
|
||||||
wf.Syntax = new(modfile.FileSyntax)
|
wf.Syntax = new(modfile.FileSyntax)
|
||||||
wf.AddGoStmt(goV)
|
wf.AddGoStmt(goV)
|
||||||
workUse(moduleLoaderState, ctx, gowork, wf, args)
|
workUse(ctx, moduleLoaderState, gowork, wf, args)
|
||||||
modload.WriteWorkFile(gowork, wf)
|
modload.WriteWorkFile(gowork, wf)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,11 +72,11 @@ func runUse(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
base.Fatal(err)
|
base.Fatal(err)
|
||||||
}
|
}
|
||||||
workUse(moduleLoaderState, ctx, gowork, wf, args)
|
workUse(ctx, moduleLoaderState, gowork, wf, args)
|
||||||
modload.WriteWorkFile(gowork, wf)
|
modload.WriteWorkFile(gowork, wf)
|
||||||
}
|
}
|
||||||
|
|
||||||
func workUse(loaderstate *modload.State, ctx context.Context, gowork string, wf *modfile.WorkFile, args []string) {
|
func workUse(ctx context.Context, s *modload.State, gowork string, wf *modfile.WorkFile, args []string) {
|
||||||
workDir := filepath.Dir(gowork) // absolute, since gowork itself is absolute
|
workDir := filepath.Dir(gowork) // absolute, since gowork itself is absolute
|
||||||
|
|
||||||
haveDirs := make(map[string][]string) // absolute → original(s)
|
haveDirs := make(map[string][]string) // absolute → original(s)
|
||||||
|
|
@ -95,7 +95,7 @@ func workUse(loaderstate *modload.State, ctx context.Context, gowork string, wf
|
||||||
// all entries for the absolute path should be removed.
|
// all entries for the absolute path should be removed.
|
||||||
keepDirs := make(map[string]string)
|
keepDirs := make(map[string]string)
|
||||||
|
|
||||||
sw := toolchain.NewSwitcher(loaderstate)
|
sw := toolchain.NewSwitcher(s)
|
||||||
|
|
||||||
// lookDir updates the entry in keepDirs for the directory dir,
|
// lookDir updates the entry in keepDirs for the directory dir,
|
||||||
// which is either absolute or relative to the current working directory
|
// which is either absolute or relative to the current working directory
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue